Structure d'une table SQL Server depuis Information_Schema
Par Michel le mardi 18 octobre 2005, 13:45 - Lien permanent
SELECT COLUMN_NAME,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH,
NUMERIC_PRECISION,
NUMERIC_SCALE,
IS_NULLABLE,
COLUMNPROPERTY(OBJECT_ID(TABLE_NAME), COLUMN_NAME, 'IsIdentity') AS IS_AUTOINCREMENT,
COLUMN_DEFAULT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'xxxxxxxx'
ORDER BY ORDINAL_POSITION
(publié à l'origine sur http://www.bigbold.com/snippets/posts/show/815)
Edit : Voir aussi "system_function_schema.fn_datadictionary", une fonction qui renvoie le dictionnaire de données pour n'importe quelle base Sql Server.
