January 11, 2006 at 6:10 pm
Dear All,
I want to create a new table using a query result in SQL Server 2003 Enterprise console, but don't know where to execute that result. Could anybody tell me where to input code in Enterprise?
I want to run:
Create Table NewTableA as
Select *, field1*10, field2*5
from OldTable1
So that I don't need to create a new table field by field tediously.
Thanks a lot!
Henry
January 11, 2006 at 11:05 pm
Henry,
I would ask the DBA to do this for you. It seems that you might not be 100% sure of what you are dealing with.
Thanks
Hope this helps...
Ford Fairlane
Rock and Roll Detective
January 12, 2006 at 2:10 am
What statement you have provided it seems that you want to create another table using results of existing table
for that you have to use select into command
in that case your query will like this
Select *, field1*10, field2*5 into NewTableA
from OldTable1
this you can execute in Query Analyzer
OR if you want to execute this from Enterprise manager then right click on OldTable1. select open table Return all rows open. click SQL. there paste above query there.
(for above you need to have select into permission for that database)
January 15, 2006 at 7:56 pm
Hello ajzy_k73,
Thanks a lot! It worked!
I executed it in Query Analyzer, and it also generated new tables!
I found the codes in SQL Server 2000 is so different from that in Oracle. ( I am even less familiar with Oracle)
In Oracle, it's Create table A as Select ... from B.
In SQL Server it's Select ... Into A from Table B...
Thanks a lot for your help & All the best,
Henry
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply