USE Northwind
GO
SELECT object_name(o.object_id) AS TableName, c.name as IdentityColumn
FROM sys.columns c JOIN sys.objects o
ON c.object_id = o.object_id
WHERE is_identity = 1
AND o.type IN ('U')
OUTPUT:
TableName IdentityColumn
Categories CategoryID
Shippers ShipperID
Suppliers SupplierID
Orders OrderID
Products ProductID
Employees EmployeeID
Did you like this post?
|
|
|
||
|
|
|
|
|
|
|
subscribe via rss |
|
subscribe via e-mail |
|
|
print this post |
|
follow me on twitter |




comments
0 Responses to "Find Out Tables in a Database Having Identity Columns"Post a Comment