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)
 SysObjects which holds table script

Author  Topic 

dvanatta
Starting Member

6 Posts

Posted - 2009-06-04 : 17:19:54
I am getting the script of views using the following SQL:

SELECT sc.text
FROM MyDBName.dbo.sysobjects so
INNER JOIN MyDBName.dbo.syscomments sc ON so.id = sc.id
WHERE so.name=N'MyViewName'

Views, Stored Procs, trigger scripts are stored in syscomments.Text but not Tables.

Where can I find the Table Script?

Thanks.

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-06-04 : 17:26:26
Tables are not compiled code so the "parsed" script definition is not stored like the other objects you mention.

You would have to generate the script either using the built in scripting functionality or construct your own "generator" by selecting out of a bunch of system tables (or information_schema views)

Be One with the Optimizer
TG
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-06-04 : 17:28:05
I think this goes in your direction:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=120447#474780


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -