Skip to main content

MSSQL .NET sysobjects Cheatsheet - Viewing and Creating Sysobjects

The following in formation should be valid for MSSQL 2005 and 2008. Sysobject creation is best handled using the GUI available at $WINDOWS\Microsoft.NET\Framework\$version_number\aspnet_regsql.exe. Under some circumstances, this may not be possible or preferable. In those circumstances, the following queries can assist you.

To view all installed sysobjects for the database, run the following query, replacing DBNAME with the name of the relevant database:

use DBNAME
go
select * from sysobjects where xtype ='P' and name like 'aspnet_%'

Sysobject creation scripts are specific to the object. The script below will create aspnet_SchemaVersions:

CREATE PROCEDURE [dbo].aspnet_CheckSchemaVersion   
@Feature                   nvarchar(128),   
@CompatibleSchemaVersion   nvarchar(128)
AS
BEGIN IF (EXISTS( SELECT  *               
FROM dbo.aspnet_SchemaVersions               
WHERE   Feature = LOWER( @Feature ) AND                       
CompatibleSchemaVersion = @CompatibleSchemaVersion ))       
RETURN 0
RETURN 1
END
GO