Home >

How to get Column information using SQL

8. March 2011

Here is the simple query you can use to fetch column information from a given table:

SELECT
ORDINAL_POSITION
,COLUMN_NAME
,DATA_TYPE
,CHARACTER_MAXIMUM_LENGTH
,IS_NULLABLE
,COLUMN_DEFAULT
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE

TABLE_NAME = 'Product' -- place your table in question here in quotes
ORDER BY
ORDINAL_POSITION ASC;

 

Another more simpler option could be to use sp_help as follows:

sp_help 'Product' -- place your table in question here in quotes

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading