Feeds:
Posts
Comments

Posts Tagged ‘generate create script for all functions in sql server database’

USE
DATABASE_NAME

GO

 

 

–Create scripts for All Procs

 

SELECT SM.definition

 

FROM sys.sql_modules
SM

 

INNER JOIN sys.Objects SO

 

ON SM.Object_id = SO.Object_id

 

WHERE SO.type = ‘p’

 

 

 

–Create scripts for All Views

 

SELECT SM.definition

 

FROM sys.sql_modules
SM

 

INNER JOIN sys.Objects SO

 

ON SM.Object_id = SO.Object_id

 

WHERE SO.type = ‘v’

 

 

 

–Create scripts for All Functions

 

SELECT SM.definition

 

FROM sys.sql_modules
SM

 

INNER JOIN sys.Objects SO

 

ON SM.Object_id = SO.Object_id

 

WHERE SO.type = ‘FN’

Read Full Post »

%d bloggers like this: