SQL Server Performance

Error: SQL State 42S22

Discussion in 'SQL Server 2005 General DBA Questions' started by L0st_Pr0phet, Nov 20, 2007.

  1. L0st_Pr0phet Member

    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?
  2. satya Moderator

    As you know about the database columns, you will be best to see which column is missing there.
  3. L0st_Pr0phet Member

    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.
  4. L0st_Pr0phet Member

    ok do not understand this but midway through the procedure it decided to become case sensitive, even though neither servers are!
  5. TechnoQuark New Member

    Which SQL Server version you are using at the moment?

Share This Page