IMHO INFORMATION_SCHEMA
> これのいずれかのために
。以下は、テーブルまたはビューで機能します。
SELECT UPPER(name)
FROM sys.columns
WHERE OBJECT_NAME([object_id]) = N'mutable';
以下は同義語(後で変更した要件)で機能します:
SELECT UPPER(name)
FROM sys.columns AS c
CROSS APPLY
(
SELECT name
FROM sys.synonyms
WHERE name = N'mutable'
AND OBJECT_ID([base_object_name]) = c.[object_id]
) AS x;
次のように言うこともできます:
DECLARE @obj INT;
SELECT @obj = OBJECT_ID([base_object_name])
FROM sys.synonyms WHERE name = N'mutable';
SELECT UPPER(name) FROM sys.columns WHERE [object_id] = @obj;