I want to execute a query on all tables but I need to inspect results. If I do:
exec sp_MSforeachtable @command1 =
'
DBCC CHECKIDENT(''?'', NORESEED)
'
The results looks like:
Checking identity information: current identity value '35', current column value '35'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Msg 7997, Level 16, State 1, Line 3
'DocumentsJobPositions' does not contain an identity column.
And so on. Sometimes it's ok sometimes I need to make some fixes, so I need the name of each table for each query!
How can I do this?
exec sp_MSforeachtable @command1 =
'
print ''?''
DBCC CHECKIDENT(''?'', NORESEED)
'