USE AdventureWorks2012
DECLARE @TBLName nvarchar(128)
SET @TBLName = N'Person'
SELECT name, object_id FROM sys.tables WHERE name = @TBLName
SELECT name, column_id, object_id
FROM sys.columns
WHERE object_id IN (SELECT object_id FROM sys.tables WHERE name = @TBLName)
ORDER BY name
No comments:
Post a Comment