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

Print function problems

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi all,

I'm trying to write a script to extract the DDL for a trigger, given the table name.

The main problem I encounter is with the print function. First to replace the char(10), (I think I solved this with the stuff function) but now I'm trying to print lines containing the "%" char, that SQL understand as a formatting for the print and mess it all up.

Any suggestion?


Thanks,
Roberto

 
If you want the script for a trigger's DDL, use sp_helptext or the utility program defncopy.exe--not quite as instructive as writing it yourself, but you can also go to sybsystemprocs and run sp_helptext on sp_helptext to see how it's done there. sp_helptext has one annoying characteristic in that it chops the DDL text up into pieces (so they'll fit in a varchar (255) column)--you'll have to put it back together by hand. Depending upon what tool you're using, often just looking for data that's right out to the left margin and backspacing twice takes care of it.

The main thing I think you'll want to do is avoid the PRINT command. Use SELECT instead.
BOL,

John Craig
Alpha-G Consulting, LLC
nsjmcraig@netscape.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top