• jeffem (12/14/2012)


    Okay, it was foolish for me to have posted confusing code. 🙂

    This is not any actual business logic that exists, but rather is a simplified example that causes the error. I had to leave urgently and was describing all of the things I could think of to test. All of my real life statements causing the issue had joins with the temp table, and I hadn't tested a straight select from the newly created object. I've now done a little more testing...

    This still receives the error:

    SELECT *

    INTO #Announcements

    FROM Announcements;

    SELECT *

    FROM #Announcements;

    I get the error ANY time I create a new table and try to reference that table in the same transaction. Semicolons don't fix it, but GO statements do. Whether I use temp or permanent tables doesn't matter.

    I found it odd (and possibly very revealing for those who know what happens behind the scenes) that Activity Monitor immediately produces the same error, as though it's opening generates a table it reads from.

    Anyway, I regretfully didn't post a question at all with my original post but left it implied. What I may need here is DBA type assistance, whereas I only know T-SQL development and have no DBA resource available.

    I did a CHECKDB, but considering I get the behavior on all databases, it's no surprise that it didn't help. I don't know what other kind of script/commands to do to test why this is not working, when it has been working for years, literally.

    I restarted the services with no success. I will be rebooting tonight, but other than that, I'm kind of lost.

    Did you check to see if the instance you are using is case-sensitive? You just need to look at the collation, and if it has CI in the name, that means it's NOT, whereas if it has CS in it, then it IS case sensitive. The reason I asked this in an earlier post is that if you don't know the instance's default collation is case sensitive, all you have to do is create a table with all lower case letters and then try to reference it with just 1 of those letters capitalized, and you'll get an error (probably the same one you are getting now), because from SQL Server's perspective, the table you asked for, doesn't exist. When case sensitivity is the default collation, you have to spell table names EXACTLY as they were spelled when created, and the luxury of not worrying about capitalization ceases to exist. Thus I wonder if someone changed the default collation ? Just something to check to be sure this isn't the cause, before getting too crazy searching for some kind of bug.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)