RATE THIS ANSWER
+1
Click to Vote:
1
0
These are backed up when you backup the database itself.
If you wanted to write something to script out the procedures, functions, triggers, etc and save them somewhere you would need to use the sp_helptext procedure within a cursor which gets the object names from the sys.procedures, sys.triggers, and sys.functions DMVs.
declare @name as sysname
declare cur CURSOR for SELECT name FROM sys.procedures
open cur
fetch next from cur into @name
while @@FETCH_STATUS = 0
BEGIN
exec sp_helptext @name
print 'GO'
fetch next from cur into @name
END
close cur
deallocate cur
The above code will print all the code on the screen. If you put this into a job step, and setup the advanced properties of the job step to log the output to a text file, you'll get all the stored procedure T/SQL into a single file. This can be replicated for triggers, functions, etc.
Last Answered:
Feb 20 2008 10:22 PM GMT by Mrdenny 
46795 pts.