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 |
|
saranrosy85@gmail.com
Starting Member
3 Posts |
Posted - 2008-09-21 : 10:18:41
|
| Please correct this query.This query is to copy the structure of a table and insert into another table.insert into tablename(select * from xxx)values |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-09-21 : 10:31:15
|
[code]insert into tablename (<column list> ( select (<column list> from xxx ) values[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2008-09-21 : 10:51:30
|
| If you want to create the table with the insert, thenselect * into tablename from xxx--Gail ShawSQL Server MVP |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-21 : 13:02:32
|
quote: Originally posted by saranrosy85@gmail.com Please correct this query.This query is to copy the structure of a table and insert into another table.insert into tablename(select * from xxx)values
if you want to copy the structure only just use modified form of query suggested by GilaMonsterselect top 0 * into tablename from xxx |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-09-22 : 00:34:36
|
quote: Originally posted by saranrosy85@gmail.com Please correct this query.This query is to copy the structure of a table and insert into another table.insert into tablename(select * from xxx)values
Your query is incorrect.You can follow this query also to copy only the structure but not data of parent tableselect * into <NewTable> from <Oldtable> where 1 = 0 |
 |
|
|
|
|
|