Istniej kilka sposobów aby wyciągnąć nazwy kolumn z tabel w bazie danych SQL Server. Oto one przedstawione poniżej,
SELECT *
FROM sys.columns
WHERE object_id = OBJECT_ID('TableName')
GO
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = N'TableName'
GO
SELECT SCHEMA_NAME(o.schema_id) SchemaName, o.Name TableName, c.Name ColumnName
FROM sys.columns c
JOIN sys.objects o ON o.object_id = c.object_id
WHERE o.type = 'U'
--AND o.name = N'TableName'
and c.name='ColumnName'
ORDER BY o.Name, c.Name;
GO
sp_help N'TableName'
GO