SQL Server 找出所有資料表, 欄位, 欄位型態.

小煎的IT筆記本: SQL Server 找出所有資料表, 欄位, 欄位型態.

SQL Server 找出所有資料表, 欄位, 欄位型態.
SELECT dbo.sysobjects.name AS sTableName,
dbo.syscolumns.name AS sColumnsName,
dbo.syscolumns.prec AS iColumnsLength,
dbo.syscolumns.colorder AS iColumnsOrder,
dbo.systypes.name + " AS sColumnsType,
dbo.syscolumns.isnullable AS iIsNull
FROM dbo.sysobjects INNER JOIN
dbo.syscolumns ON dbo.sysobjects.id = dbo.syscolumns.id INNER JOIN
dbo.systypes ON dbo.syscolumns.xusertype = dbo.systypes.xusertype
WHERE (dbo.sysobjects.xtype = ‘U’)
and (dbo.systypes.name+" IN (‘varchar’, ‘char’) )

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

What is 6 + 6 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)