1

I have list of strings: var ids = ["aa", "cc, "bb"];

and I want to insert them into temporary table. This is how I try to do it:

DROP TABLE IF EXISTS Ids;
CREATE TEMP TABLE Ids AS
SELECT Id FROM @ids

however that throws syntax error. How it should be done?

1
  • What kind of error? Please, provide error details. Commented Aug 23, 2021 at 17:36

1 Answer 1

2

The parameter is an array, so the query should use array functions

CREATE TEMP TABLE Ids AS
SELECT unnest(ARRAY['a','b','c']);

or using the .net place holder:

CREATE TEMP TABLE Ids AS
SELECT unnest(@ids);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.