I saw that another poster (WolfiG) asked a very similar question, but I do not see the answer. (I understand the error message, and I am NOT looking for how to fix the error, I am trying to determine if there is any type of error checking (or debugging method) for other errors.
I found a similar code and added to it to get every table in every database on the server ... and show PK and rowcounts. (Working with inventory, and then using a data dictionary, but this is not a problem, I just explain how this code became.)
SO in this case, I already narrowed the data a bit (this means that I know which database I am querying and encountered an error), so there were “only” 81 tables (rows) that could be erroneous. BUT, of course, this will require too much manual checking to find the problem, so I was hoping there was a way to see which "t.name" was being read when the subquery got an error. (I narrowed it down to the first subquery, commenting the line at a time (it was 10, and I just didn't copy them all here.)
Again a question (and it seems that I'm not the only person asking this question)
Is there a way to determine which row (data) caused an error in the request?
and in the example below, was there a way to display t.name (or other column data) was the most recent when an error occurred?
Mainframe - . , , , , , , .
Msg 512, 16, 1, 1
1 . , =,! =, <, < =, > , >= .
use [DBName]
SELECT '[DBName]' as DBName, t.NAME, it.xtype,i.rowcnt,
(select c.name from syscolumns c inner join sysindexkeys k on k.indid=i.indid and c.colid = k.colid and c.id=t.id and k.keyno=1 and k.id=t.id)as 'column1',
(select c.name from syscolumns c inner join sysindexkeys k on k.indid=i.indid and c.colid = k.colid and c.id=t.id and k.keyno=2 and k.id=t.id)as 'column2'
from sysobjects t inner join sysindexes i on i.id=t.id
LEFT OUTER JOIN sysobjects it on it.parent_obj=t.id and it.name = i.name
WHERE i.indid < 2 AND OBJECTPROPERTY(t.ID, 'IsMSShipped') = 0
!
, , ( , - ), "select count (c.name) syscolumns", , > 1.
, . ( , , SQL , DB . GRRRR)
"i.indid < 2" , - rowcnt, , , . , - , - : i.indid < 2
, , , "" /ARGHHH , , COLS , ( , , ), ). , , , MAYBE sysindexes.status = - , . ARGGGH