Виртуальная песочница (тм)

Wednesday, May 14, 2008

MS SQL's equivalent of Oracle's "DESCRIBE"

SELECT
column_name
, data_type +
COALESCE(
'(' + CAST(character_maximum_length AS VARCHAR) + ')'
, '(' + CAST(numeric_precision AS VARCHAR) + ')'
, ''
)
, column_default
, is_nullable
FROM
information_schema.columns
WHERE
table_name = 'tablename';

No comments: