Sunday, March 25, 2012

creating a table with select into

Hi,
how can i create a new table from a select statement? i use select into, but
my select query has case columns and query analyzer says that i did not
specified a column for them. how do i do it?
thanks in advance for your helpGive the column a name. Make this:
SELECT somecolum, CASE when x then y else z END
INTO #table
FROM table
look like this:
SELECT somecolum, CASE when x then y else z END AS SomeNewColumn
INTO #table
FROM table
or this:
SELECT somecolum, 'SomeNewColumn' = CASE when x then y else z END
INTO #table
FROM table
Keith
"Jose" <norespondais@.almailpor.favor> wrote in message
news:uNmJgiTDFHA.1396@.tk2msftngp13.phx.gbl...
> Hi,
> how can i create a new table from a select statement? i use select into,
but
> my select query has case columns and query analyzer says that i did not
> specified a column for them. how do i do it?
> thanks in advance for your help
>sql

No comments:

Post a Comment