SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMNPROPERTY -- get columns where is_identity = 1
(OBJECT_ID(QUOTENAME(table_schema) + '.' + QUOTENAME(table_name)) -- table ID
,column_name, 'isidentity') = 1
ORDER BY table_name, ordinal_position
WHERE COLUMNPROPERTY -- get columns where is_identity = 1
(OBJECT_ID(QUOTENAME(table_schema) + '.' + QUOTENAME(table_name)) -- table ID
,column_name, 'isidentity') = 1
ORDER BY table_name, ordinal_position
No comments:
Post a Comment