How To Fetch Table Objects Info in Sql Server

Jayakumars
Posted by Jayakumars under Sql Server category on | Points: 40 | Views : 788
Hi
I have Post Code.How To Fetch Table Objects Info in Sql Server

Run Procedure
=========================
Exec sp_FindDatatype 'Employee'


Create Procedure
=====================
Create Proc sp_SelectTableDetails
@TblName varchar(50)
as
SELECT COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,IS_NULLABLE,ORDINAL_POSITION FROM INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME=@TblName
OR
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME=@TblName

Comments or Responses

Login to post response