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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-11-02 : 08:12:59
|
| AMARENDRA writes "HOW TO CREATE A TABLE WITHOUT COPYING ITS DATA FROM A TABLE?" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-02 : 08:14:06
|
| One of the methods isSelect * into newTable from OldTable where 1=0MadhivananFailing to plan is Planning to fail |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-11-02 : 08:14:23
|
| SELECT TOP 0 * INTO newTable FROM myTableorSELECT * INTO newTable FROM myTable WHERE 1<>1This will only copy column names and data type. Constraints, keys, and indexes will not be copied. To copy those you'd have to generate the table's script using Enterprise Manager or programming a SQL-DMO Script method. |
 |
|
|
|
|
|