在查询中打印 table 名称

Print table name inside a query

我想对所有 table 执行查询,但我需要检查结果。 如果我这样做:

exec sp_MSforeachtable @command1 = 
'
DBCC CHECKIDENT(''?'', NORESEED)
'

结果如下:

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.

等等。有时没关系有时我需要做一些修复,所以我需要每个查询的每个 table 的名称!

我该怎么做?

exec sp_MSforeachtable @command1 = 
'
print ''?''
DBCC CHECKIDENT(''?'', NORESEED)
'