Tuesday, 22 October 2013

SQL SP_HELP and SP_COLUMNS Stored Procedures to View,Define and Describe the Structure of a Table

SQL Server- SP_HELP and SP_COLUMNS Stored Procedures to Describe Table Structure 
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 ... :
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 ...:
SP_HELP ORDERS





No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts