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
 General SQL Server Forums
 New to SQL Server Programming
 How to show table creation script programmaticall?

Author  Topic 

concoran
Starting Member

7 Posts

Posted - 2010-02-15 : 05:45:12
If there is a table, it's easy to right click and use 'script table as' and generate table creation script.
But, is there a programmatic way to do it?

DaleTurley
Yak Posting Veteran

76 Posts

Posted - 2010-02-15 : 05:58:50
There is in .Net using a Scripter object from the Microsoft.SQLServer.SMO namespace.

Not familiar with a way through SQL Server though...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-15 : 06:01:16
What is wrong with doing it via SSMS?

However you can try this

http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/generate-sql-script.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-15 : 07:57:58
this is SMO method

http://www.mssqltips.com/tip.asp?tip=1833

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -