Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to query "Script table as"

Status
Not open for further replies.

pdbowling

Programmer
Mar 28, 2003
267
US
Hello, Everyone.

I am trying to do some automated re-creation of some tables in Sql Server 2008.

When you right click a table, you can choose 'Script table as' and get everything you need to know to re-create the table.

I was curious if there was a way to do this using tsql that I could read in C#?

Not a big deal if not, it would just greatly simplify things.

Appreciated.
Patrick
 
I know of sys.all_columns, however this is not what you are looking for.

Hopefully someone will know the answer.

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
I suggest you look in to using SQL SMO from within C#. If I am not mistaken, this is exactly what SQL Server Management Studio uses. I have no doubt that a quick google search for "SQL SMO Create Table Script" will be very helpful to you.



-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top