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 2000 Forums
 Transact-SQL (2000)
 DDL from stored procedure

Author  Topic 

clarkbaker1964
Constraint Violating Yak Guru

428 Posts

Posted - 2004-09-14 : 14:28:15
How can the DDL on a table be generated from a stored procedure...
What gets procedures get called when Enterprise manager or query analyzer when generating DDL


I have a relatively rather large system that is poorly documented and I would like to create Historical snapshots of records that users are deleting from the system.

These deletions follow cascade deletes in some cases but have foreign key constraints in others.

I only want to create the tables where rows are being deleted from the database... not recreate the entire data structure which contains many objects that are related to other processes and systems.

nr
SQLTeam MVY

12543 Posts

Posted - 2004-09-14 : 22:23:14
See
http://www.nigelrivett.net/DMOScripting.html
http://www.nigelrivett.net/DMOScriptAllDatabases.html

I would use the second and pick the ones you need.

If you want an audit trail then consider a select into then get rid of identitied.
You can also audit trail into a single table - see triggers on the site above.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

clarkbaker1964
Constraint Violating Yak Guru

428 Posts

Posted - 2004-09-15 : 14:24:54
Your the man!

Surf On Dude!
Go to Top of Page
   

- Advertisement -