2010-06-29 1 views

Répondre

1

Cela devrait faire l'affaire. Il y a un peu plus d'informations ici mais je pense que vous le trouverez peut-être utile.

Select t.Table_Schema, 
     t.Table_Name, 
     c.Column_Name, 
     IsNull(c.Column_Default, '') as 'Column_Default', 
     c.Is_Nullable, 
     c.Data_Type, 
     IsNull(c.Character_Maximum_Length, IsNull(Numeric_Precision,'') + IsNull(Numeric_Scale, IsNull(DateTime_Precision,''))) as 'Size' 

From Information_Schema.Tables t 

Join Information_Schema.Columns c on t.Table_Catalog = c.Table_Catalog 
           And  t.Table_Schema = c.Table_Schema 
           And  t.Table_Name = c.Table_Name 

Where t.Table_Type = 'BASE TABLE' 

Order by t.Table_Schema, t.Table_Name, c.Ordinal_Position 
+0

+1 Mais vous avez oublié la structure "et", quelle qu'elle soit. Contraintes? Index? Les fonctions? Procédures stockées? Vues ?, etc ;-) –

+0

@Brock Adams - oui c'est vrai. "et la structure" est légèrement vague donc je l'ai basé sur la production attendue. Cela dit, je ne suis pas sûr d'où vient la description :-) – codingbadger

Questions connexes