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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripting objects in the DB

Status
Not open for further replies.

jazerr

Programmer
Dec 13, 2000
152
0
0
US
I have a situation where I need to be able to run a SP and have a new DB created with the exact SAME definition.

The best way I can figure is to write a set of SPs that script out the DB to .sql files, then actually run those files autmatically.

I already have a SP that uses the sp_OAMethod and its homies to output the definition of all the tables. This works very well.

However I cannot figure out how to spit out the definitions of SProcs, functions, or views. ANyone have ideas?>
 
HI,

Code:
    select b.name, a.text 
    from syscomments a 
    join   sysobjects b  
    where a.id = b.id and b.type in ('p','fn','v')

B.R,
miq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top