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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Create table from existing table schema

Author  Topic 

RIKIL
Starting Member

20 Posts

Posted - 2010-07-26 : 12:30:22
I am not able to find what I am looking for so I thought I would ask the experts...

First, we want to do all this in code (probably C#). What we want to do is call a command in C# that will generate us a create table statement from an existing table in one DB that we can then run to create a table with the same schema in a different DB.

We'd like to get the actual code that is used to create the table so we can use it to create the table like I mentioned above but we want to do other things with it as well. So I was looking for some method to return me the exact same thing I see when I go to SQL, right click on a table and select Scippt Table as...Create...to new query window.

What I see there is what I would like to capture.

Ideas on that?

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-26 : 12:59:49
Give to the dbas what belongs to the dbas...give to god what belongs to god...

See, nowhere in there does it say anything about developers



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -