Wednesday, January 11, 2012

SQL :: Colunas

O SQL abaixo lista as colunas de uma tabela do banco de dados:
 
SELECT o.name AS [Table Name], o.type, c.name AS [Col Name],  
s.name AS [ColType], c.prec, c.scale 
FROM dbo.sysobjects o INNER JOIN
dbo.syscolumns c ON c.id = o.id INNER JOIN
dbo.systypes s ON c.xtype = s.xtype
WHERE
(o.type = 'U')

No comments: