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.
Author |
Topic |
Daffyydd
Starting Member
2 Posts |
Posted - 2007-08-01 : 04:52:36
|
Is it possible to create a database using the Select query. For ExampleCreate Database #temp(select * from Sales) |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-01 : 05:25:49
|
1 No2 You can create a table using a Select querySelect * into #temp from SalesMadhivananFailing to plan is Planning to fail |
 |
|
Daffyydd
Starting Member
2 Posts |
Posted - 2007-08-01 : 06:01:56
|
So it means i have to create the table #temp first before selecting into. |
 |
|
pootle_flump
1064 Posts |
Posted - 2007-08-01 : 07:16:11
|
quote: Originally posted by Daffyydd So it means i have to create the table #temp first before selecting into.
No. Selecting into syntax creates the table for you. Insert into requires the table exists already. You are, however, typically advised to not use select into where possible especially for any long running queries. |
 |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-08-01 : 11:47:26
|
You'll not get keys nor indexes on target table when create table this way. |
 |
|
|
|
|