SQL Server 2005 batch query custom object script


Official reference of object definition

The following code can batch view or export scripts for views, stored procedures, triggers, and functions

Copy codeThe code is as follows:
select name , xtype , object_definition (id ) from sysobjects
where xtype in (‘V’ , ‘P’ , ‘TR’ , ‘IF’ , ‘TF’ , ‘FN’ )
order by xtype , name

Equivalent to the above code, sys. SQL modules system table can be used instead of object definition function

Copy codeThe code is as follows:
select b. name , b. xtype , a . definition from sys .sql_modules a , sys .sysobjects b
where a . object_id = b. id
order by b. xtype

Recommended Today

Netsh.exe Description of tools and command line switches

use Netsh.exe Tools that direct the context commands you enter to the appropriate helper, which then executes the command. A helper is a dynamic link library (. DLL) file that extends by providing configuration, monitoring, and support for one or more services, utilities, or protocols Netsh.exe Function of the tool. Helpers can also be used […]