Saturday, October 5, 2013

How To Display all Tables Of a Database SQL SERVER

In order to display the Names of all Tables Or Details of all Tables of a Database, We have different alternative methods.

1. Using Information_Schema : By using Information_Schema.Tables Or Information_Schema.Columns

Syntax: 
  • Select Table_Name From Information_Schema.Tables Where Table_type = 'BASE TABLE'
  • Select Distinct Table_Name FromInformation_Schema.Columns
2. Using SysObjects :
Syntax:
  • Select * From Sys.Objects Where Type 'U'
  • Select * From SysObjects Where Xtype = 'U'
3. Using System Stored Procedures
Syntax:
  • Exec Sp_Tables @Table_Type = "'TABLE'"
  • Exec Sp_MsForEachTable 'Print ''?'''

No comments:

Post a Comment

Complete Authentication System in ASP.NET Core using JWT

JWT (JSON Web Token) authentication is widely used for securing APIs in modern applications. In this article, we will build a complete authe...