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

📱Build WhatsApp Bot using .NET + OpenAI

   In this article, you will learn how to build a real-world WhatsApp chatbot using ASP.NET Core and OpenAI. This bot can automatically repl...