Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 select into??

Author  Topic 

GoDaddy
Yak Posting Veteran

64 Posts

Posted - 2009-02-25 : 09:22:37
I want to return a structure ColumnA, ColumnB, ColumnC, ColumnD

From a table that only contains ColumnA, ColumnB.

I thought in my script of creating a #Temp table with all 4 columns.

But I don't know how to select data from the table to put them into that #Temp table

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-25 : 09:28:17
[code]SELECT ColumnA,ColumnB,CAST(NULL AS datatype) AS ColumnC,CAST(NULL AS datatype) AS ColumnD INTO #Temp FROM Table[/code]

make sure you replace datatype with the appropriate ones you want for other two columns
Go to Top of Page

GoDaddy
Yak Posting Veteran

64 Posts

Posted - 2009-02-25 : 09:38:05
Thanks!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-25 : 09:41:15
welcome
Go to Top of Page
   

- Advertisement -