I have a SQL Server table. I need to create the same table in another database. How would I see what the Create Table query was that created the table so I can just run that.
CREATE TABLE ..
I have a SQL Server table. I need to create the same table in another database. How would I see what the Create Table query was that created the table so I can just run that.
CREATE TABLE ..
In SSMS you can right click the table and select Script Table as Create to New Query Window.
Let's assume SQL Server 2005 or greater, since you did not specify. In Management Studio, simply right-click on the table, select Script Table As --> Drop and Create --> To New Query Editor Window.
For SQL Server 2000, in Enterprise Manager, right-click the table and you'll have a similar option to script the table creation to a file. I forget the exact menu option text, but it's easy enough.