Insert multiple rows into temp table with one command in SQL2005

Posted by Adam Haile on Stack Overflow See other posts from Stack Overflow or by Adam Haile
Published on 2010-04-20T15:41:16Z Indexed on 2010/04/20 15:43 UTC
Read the original article Hit count: 230

Filed under:
|
|

I've got some data in the following format:

-1,-1,-1,-1,701,-1,-1,-1,-1,-1,304,390,403,435,438,439,442,455

I need to insert it into a temp table like this:

CREATE TABLE #TEMP
(
Node int
)

So that I can use it in a comparison with data in another table.

The data above represents separate rows of the "Node" column.

Is there an easy way to insert this data, all in one command?

Also, the data will actually being coming in as seen, as a string... so I need to be able to just concat it into the SQL query string. I can obviously modify it first if needed.

© Stack Overflow or respective owner

Related posts about tsql

Related posts about sql