SQL Server SUPER FAST Generate Script 1.0
How many times have you had to get a bunch of sprocs, udf's and views from one DB and need to generate Alter scripts for each only to realize that perusing thru SSMS one at a time or via the Object explorer details even with multi-select can be tedious?
Well there is an option or 2 that can help!
Pre Reqs,
1. sp_LongPrint.sql
You will need the following sproc that prints varchar(max) to the PRINT, else long content is truncated, See attachment
Option 1:
Open
GetSprocs.Basic.sql, Super Simple, gets sprocs and udfs using INFORMATION_SCHEMA.Routines, Just set the DB to your DB and criteria and boom, it spits out the DDL:
...
SELECT r.Routine_Definition, routine_name
FROM INFORMATION_SCHEMA.Routines r
where ...
...
exec master..[sp_LongPrint] @txt
...
Option 2:
1. Get
vw_DBAObjects.sql run that view to create on target DB,
2. Now open
GetSprocs.Advanced.sql, set your DB and criteria, voila u can get VIEWS, Sprocs, UDFS, TVF's DDLs with one click. You can print out 50 views in 1 second!
3. Yay.
See attached zip for source, uses DB AdventureWorksDW2012 by default
Download the Source Here