how to dynamically create a table with same columns as that of previous table. in sql
3 Answers
select * into new_table from table
Thats works in SQL2005
1 Comment
Innova
thanks for your reply, i need to create oly the table with the entire columns and not the datas. the fresh datas has to be into the new table.
I believe that both of the above answers will work, but since you don't need the data and you just need the format, I would do the following:
select * into new_table from table
TRUNCATE new_table; -- I'm sure you know this, but just in case someone is new and doesn't, truncate leaves the table structure and removes all of the data.