February 5th, 2003, 10:18 AM
copy table in mssql
How do I copy a mssql table? I have tablex and want to create a dublicate and call it tablex_b. Is there a sql statement that can do this?
February 5th, 2003, 11:18 AM
not sure about the mssql syntax, you should check your documentation to be sure, but it should be something like this:
create table sometablename like some_other_table_name
February 5th, 2003, 11:34 AM
Oh really, it is just that simple? and that will create the new table and populate it with the existing records?
February 5th, 2003, 11:51 AM
No, it will just create a table with the exact same structure.
To copy the structure and fill it with the same data you might (not sure) can do this
You will have to check your documentation to be sure.
create table sometablename as (select * from some_other_table_name)
February 5th, 2003, 12:16 PM