This is how you return all the tables with their last generated identity values in a SQL Server Database
SELECT IDENT_CURRENT(table_name),*
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'base table'
AND OBJECTPROPERTY(OBJECT_ID(table_name),'TableHasIdentity')=1
Monday, April 14, 2008
Use IDENT_CURRENT() to return the last identity value generated of all tables in a SQL Server Database
Posted by Denis at 11:15 AM
Labels: SQL Server 2000, SQL Server 2005, SQL Server 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment