Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
djcarpen11
Starting Member
25 Posts |
Posted - 2010-06-11 : 05:07:43
|
| I have the below querySELECT 'DBCC CHECKIDENT (''' + name +''');' nameFROM sys.objectsWHERE OBJECTPROPERTY(OBJECT_ID(name), 'TableHasIdentity') = 1 and name = 'tblBDRoutingQuote'AND TYPE ='U'How do I dynamically execute all the checkindent commands and insert them and the table name into a table?I'm really struggling with this one. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-06-11 : 05:27:32
|
Why make things much harder than it is?SELECT QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) AS TableName, IDENT_CURRENT(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)) AS CurrentIdentityValueFROM INFORMATION_SCHEMA.TABLES N 56°04'39.26"E 12°55'05.63" |
 |
|
|
djcarpen11
Starting Member
25 Posts |
Posted - 2010-06-11 : 05:34:55
|
| Thanks for the reply, We're having some strange issues with an upgrade from sql 2000 to 2008 where the seeding of a table was out of sync, we're still unsure to why this is happening but the fix seems to be to change the compatibility level in the database options. So I'm trying to construct a qury we can run agaist databases on this upgrade and future sql 2000 to 2008 upgrades that check the table seeding. I need the query to put the results of the dbcc checkindet query in to a table and query the diff between them.hope that makes sense???Dave |
 |
|
|
djcarpen11
Starting Member
25 Posts |
Posted - 2010-06-11 : 08:08:14
|
| no one any ideas with this problem? |
 |
|
|
|
|
|