Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieve Column Info
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01313335
Message ID:
01313337
Vues:
9
>I want to return info about a SQL 2005 dtabases's tables.
>
>This code returns the a table who's columns are TableName, ColumnName, ColumnDesc and Sequence. What do
>I need to add to get Column Size, Precision, Null/Not Null, PK info, ect?
>
>
>
>SELECT      o.Name AS ObjectName,
>            c.name AS ColumnName,
>            ep.value AS ColumnDesc,
>            c.colid AS Sequence
>FROM        sys.objects o INNER JOIN sys.extended_properties ep
>            ON o.object_id = ep.major_id
>            INNER JOIN sys.schemas s
>            ON o.schema_id = s.schema_id
>            LEFT JOIN syscolumns c
>            ON ep.minor_id = c.colid
>            AND ep.major_id = c.id
>WHERE       o.type = 'U'
>ORDER BY    ObjectName, Sequence
>
>
I would do something like this instead:
select * from INFORMATION_SCHEMA.COLUMNS
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform