Unanswered: Output database object script to .sql file in SQL Server
I am trying to automate the process of extracting DDL scripts for each object (Procedures, functions, Packages and not tables, views - for all schema's) on a seperate file from SQL Server database.
I have about 100 procedures, 100 functions and I want to output these scripts to a .sql files on a file server at some location.
After extraction it should be something like this:
C:\ScriptBkp\Proc1.sql, proc2.sql, proc3.sql, so on.....proc100.sql, Func1.sql, Func2.sql, so on....Func100.sql, Pkg1.sql, Pkg2.sql, Pkg3.sql, so on....Pkg100.sql
Take help of Generate SQL scripts from Enterprise Manager --> Tools --> Generate SQL Scripts and script the objects into one file and use ISQL/OSQL to execute the script, you can also schedule this as a job using SQLAGent.