I have a series of stored procedures that fire and basically report on database size and drive space. No If I run these stored procedures on some SQL Instances they work fine, but on one when it comes to the 34th loop in the cursor, it errors with the below message. Executed as user: DXSQLService. Invalid column name 'date'. [SQLSTATE 42S22] (Error 207) Invalid column name 'DB_name'. [SQLSTATE 42S22] (Error 207). The step failed. basically I have one stored procedure firing a second inside a cursor that passes the database name to the second stored procedure in the loop. The second the uses sp_execute sql to dynamically query each databases sysfiles. Now when It gets to the 34th database it errors? any ideas on this error?
see thats where I first started out thinking, I am missing dbname or date! But its the same stored procedure pointing to the same linked server as the previous 33 times it runs and completes fine. I did change the sp_executesql statement to use a alias so it was inserting data into a.dbname and a.date, this worked once but then stopped working with the same error. I was wondering if anyone come accross mis-reporting of this type of error. If not I will re-write the whole thing to operate different.
FYI ok do not understand this but midway through the procedure it decided to become case sensitive, even though neither servers are!