23 April, 2012

Simple Queries in SQL Server


  •  Get Column Name, Data Type and Data Length of a table. Here hrm_employee is a table name.

SELECT COLUMN_NAME 'Column Name',

DATA_TYPE 'Data Type',

CHARACTER_MAXIMUM_LENGTH 'Maximum Length'

FROM information_schema.columns

WHERE TABLE_NAME = 'hrm_employee'


After executing the query, you will see all column name of hrm_employee table with data type and length.

No comments:

Post a Comment