Archive for the ‘SQLServer’ Category

Looking at the database structure (in MSSQL)

Tuesday, December 11th, 2007

This query will show how the current database looks (what columns exists in what tables etc), the select might be a * instead but this is the info I find interesting.

select TABLE_NAME, COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH

from INFORMATION_SCHEMA.COLUMNS

order by TABLE_NAME, ORDINAL_POSITION