SansSQL

Wednesday, July 16, 2008

Undocumented stored procedure for retrieving SQL Agent properties

sp_get_sqlagent_properties is and undocumented stored procedure to retrive the SQL Agent properties of a particular server. This stored procedure can be found in msdb database.

Usage:
EXEC msdb..sp_get_sqlagent_properties

Undocumented stored procedure:: sp_MS_upd_sysobj_category

sp_MS_upd_sysobj_category is an undocumneted stored procedure which Enables or disables a special system mode where all newly created objects are automatically shown as system objects in enterprise manager. sp_MS_upd_sysobj_category accepts a parameter @Mode. @Mode can either be 1 or 2. Setting the value of @Mode to 1 enables this special system mode and setting it to 2, disables it. Among other things, sp_MS_upd_sysobj_category allows the creation of user-defined INFORMATION_SCHEMA views.

Usage:
EXEC master.dbo.sp_MS_upd_sysobj_category @Mode
@Mode = 1 or 2
1=Enable
2=Disable

Enable special system mode:
EXEC master.dbo.sp_MS_upd_sysobj_category 1

Disable special system mode:
EXEC master.dbo.sp_MS_upd_sysobj_category 2

Friday, July 11, 2008

UnDocumented stored proc to read the error log

EXEC sp_readerrorlog

sp_readerrorlog is an undocumented stored procedure which helps in reading the SQL server error log.

UnDocumented stored proc to find the primary key and foreign key Constraints defined on a table

EXEC sp_MStablekeys @TableName

sp_MStablekeys is an undocumented stored procedure to find all the primary keys and foreign keys defined on a particular table in SQL 2000 and SQL 2005.
This Stored procedure accepts a parameter @TableName and gives the primary keys and foreign keys defined on a that table.

UnDocumented stored proc to find the Check Constraints used in a table

EXEC sp_MStablechecks TableName

sp_MStablechecks is an undocumented Stored Procedure in SQL 2000 and SQL 2005 which helps in finding the various Check constraints used in a particular table. This stored proc accepts a parameter TableName and gives the various check constraints used in that table.

Ads