Link to home
Start Free TrialLog in
Avatar of jrspano
jrspanoFlag for United States of America

asked on

copy table definition

I need a sql statement that copies a table with all related stuff EXACLTY, but without the data to a new table name.  I has to work in sql server 7 and 2000 and must bring permissions and preferably indexes, defaults, etc with it.

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of ykchakri
ykchakri

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Guy Hengel [angelIII / a3]
I suggest that you look up the "generate script" in the "all tasks" menu of the table(s).
Cheers
Avatar of vim_asteya
vim_asteya

see if this helps
create table t1(select * from mytable where 1=2)
t1- is the new table
mytable-is the table who's copy u want
this will copy the structure alone without any data
Avatar of jrspano

ASKER

thanks for all your input but unfortunatly it wont produce any dynamic output.  the script is static to my database.  I need something dynamic that will take a table I tell it to and make another table with the same table structure and permissions.
Avatar of jrspano

ASKER

i ended up using this, and not needing the user definitions. thanks