Wednesday 25 November 2015

You can find some important entities through the sysobjects view like this:

  1. Aggregate Function: Get the name of all Aggregate functions.

    Select name,type from sysobjects where type='AF'
     
  2. Foreign Key: Get the name of all Foreign Keys.

    Select name,type from sysobjects where type='F'
     
  3. Function: Get the name of all scalar functions.

    Select name,type from sysobjects where type='FN'
     
  4. Stored Procedure: Get the name of all Stored Procedures.

    Select name,type from sysobjects where type='P'
     
  5. Primary Key: Get the name of all Primary Keys.

    Select name,type from sysobjects where type='PK'
     
  6. Table-Valued-Function: Get the name of all Aggregate functions.

    Select name,type from sysobjects where type='TF'
     
  7. Trigger: Get the name of all DML triggers.

    Select name,type from sysobjects where type='TR'
     
  8. Tables: Get the name of all Tables (user-defined).

    Select name,type from sysobjects where type='U'
     
  9. View: Get the name of all Views.
Select name,type from sysobjects where type='V'

The following are all the types of entities in the sysobjects view:
AF = Aggregate function (CLR)
C = CHECK constraint
D = DEFAULT (constraint or stand-alone)
F = FOREIGN KEY constraint
FN = SQL scalar function
FS = Assembly (CLR) scalar-function
FT = Assembly (CLR) table-valued function
IF = SQL inline table-valued function
IT = Internal table
P = SQL Stored Procedure
PC = Assembly (CLR) stored-procedure
PG = Plan guide
PK = PRIMARY KEY constraint
R = Rule (old-style, stand-alone)
RF = Replication-filter-procedure
S = System base table
SN = Synonym
SO = Sequence object
SQ = Service queue
TA = Assembly (CLR) DML trigger
TF = SQL table-valued-function
TR = SQL DML trigger 
TT = Table type
U = Table (user-defined)
UQ = UNIQUE constraint
V = View
X = Extended stored procedure


No comments:

Post a Comment