Exporting SQL Server Procedures and Functions to Files
The bcp utility shipped with SQL Server can help. The following query generates one bcp command line per procedure. All commands can then be copied to a batch file and executed from the command line.
In the query below replace
select 'bcp "SELECT routine_definition from
+ routine_name + '''" QueryOut "c:\temp\procs\'
+ routine_schema + '.' + routine_name + '.sql" -c -S
from information_schema.routines
Labels: SQL Server
