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 |
Alex2011
Starting Member
18 Posts |
Posted - 2011-04-27 : 16:23:44
|
Hi, how can I create a table directly from a view or query in SQL server 2000? thanksAlex |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2011-04-27 : 16:39:46
|
Example:select top 5 * into dbo.test from TableNameMike"oh, that monkey is going to pay" |
|
|
Alex2011
Starting Member
18 Posts |
Posted - 2011-04-27 : 17:00:55
|
Thanks for your replies. so I have to create a table first then insert the rows instead of create a table from a view directly? likecreate table afrom (select *from view) |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-04-27 : 17:22:01
|
If you create the table first, use INSERT INTO...SELECT, rather than SELECT...INTO :CREATE TABLE a(columns...)INSERT INTO aSELECT *FROM TableOrViewNameSELECT...INTO will create the table on the fly, as long as it doesn't already exist. |
|
|
Alex2011
Starting Member
18 Posts |
Posted - 2011-04-27 : 17:42:21
|
this is Great! You guys are awesome!thanks a lot!this is exactly what i wanted. Select *Into testfrom view |
|
|
|
|
|