Tuesday, October 22, 2013

How to use SP_HELP and SP_COLUMNS Stored Procedures in SQL Server

How to use SP_HELP and SP_COLUMNS Stored Procedures to View, Define and Describe the Structure of a Table in SQL Server
We can use the SP_HELP and SP_COLUMNS stored procedures define the structure of a Table in SQL-Server.
SP_COLUMNS :
This stored procedure returns column information for the specified objects that can be queried in the current environment.
Example :
CREATE TABLE ORDERS(OID INT NOT NULL,CNAME CHAR(15),
PRODUCT VARCHAR(15),P_COST DECIMAL(10,2));

The  SP_COLUMNS Procedure Describes the Table like this ... :
Exec SP_Columns ORDERS

SP_HELP:
Reports information about a database object (any object listed in the sysobjects table), a user-defined data type, or a data type supplied by Microsoft® SQL Server™.
Example :
CREATE TABLE ORDERS(OID INT NOT NULL,CNAME CHAR(15),
PRODUCT VARCHAR(15),P_COST DECIMAL(10,2));

The  SP_HELP Procedure Describes the Table like this ...:

Exec SP_HELP ORDERS


Thanks, Tamatam

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog