その表情をしています
SELECT sysobjects.name AS TableName,
c.name AS ColumnName,
st.name AS TypeName,
"Length"
= case st.name
when 'uniqueidentifier' then 'nvm'
when 'bit' then 'nvm'
when 'int' then 'nvm'
when 'image' then 'nvm'
when 'datetime' then 'nvm'
when 'xml' then 'nvm'
else (cast(c.length as varchar))
end,
case c.isnullable
when '0' then 'No'
when '1' then 'Yes' end AS 'Nullable'
FROM
dbo.syscolumns c WITH (NOLOCK)
INNER JOIN dbo.systypes st ON st.xusertype = c.xusertype
INNER JOIN dbo.sysobjects WITH (NOLOCK) ON sysobjects.id=c.id
WHERE sysobjects.type in ('U')
ORDER BY TableName
だから私はこの出力を取得します:
ACCREDITED_PROGRAMS ID uniqueidentifier nvm No
ACCREDITED_PROGRAMS APPLICATION_FK uniqueidentifier nvm Yes
ACCREDITED_PROGRAMS LICENCED_PROGRAM_FK uniqueidentifier nvm Yes
問題は、隣接する 2 つの列に、APPLICATION_FK、LICENCED_PROGRAM_FK、およびその他の FK を参照するテーブルとフィールドを示すことです。