Wednesday, 4 February 2015

Get Table, Procedure, View etc list in SQL

Get Table, Procedure, View etc list in SQL:
SELECT sobjects.name
FROM sysobjects sobjects
WHERE sobjects.xtype = 'U'

sobject List:
-----------------
    C: Check constraint
    D: Default constraint
    F: Foreign Key constraint
    L: Log
    P: Stored procedure
    PK: Primary Key constraint
    RF: Replication Filter stored procedure
    S: System table
    TR: Trigger
    U: User table
    UQ: Unique constraint
    V: View
    X: Extended stored procedure

Get List Of Function:
-----------------------------
SELECT b.name fncSchema, a.Name AS function_name, TYPE
FROM sys.objects a
INNER JOIN sys.schemas b
ON a.schema_id = b.schema_id
WHERE TYPE in ('FN', 'IF', 'TF')

No comments:

Post a Comment