Thursday, March 30, 2023

MS-SQL Server - Show Table

Show Table


We can query a system table to find the below categories of user objects.

- Procedures
- Views
- Tables
- Functions

SELECT
  *
FROM
  SYSOBJECTS
WHERE
  xtype = 'U'
GO

                    /////////   or   /////////
                   
SELECT
  *
FROM
sys.objects
WHERE
  type = 'U'
GO

Object type:

AF = Aggregate function (CLR)
C = CHECK constraint
D = DEFAULT (constraint or stand-alone)
F = FOREIGN KEY constraint
FN = SQL scalar Function
P = SQL Stored Procedure
U = Table (user-defined)
V = View

https://learn.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-objects-transact-sql?view=sql-server-ver16

Best Regards

T. Amit Vaid S.

No comments: