Jeff, I agree 100% with you. The problem is when you build a temp table using:
SELECT * INTO #tmp FROM SOMETABLE ...
and SOMETABLE has an identity column in it SQLServer assumes you want that column in the temporary table to be identity as well. As usual, there are a number of ways to skin a cat. One would be to cast the offending column into a bigint type...
SELECT Cast(MYIDCOL as bigint) AS MYIDCOL, ANOTHER_COL, ... INTO #tmp FROM SOMETABLE ...
However, the solution to my problem was to take my right palm and smack it firmly against my forehead! When I originally created the stored procedure I had neglected to prepend the schema to the procedure name. I realized immediately that I had goofed and repaired that. However, at the time, I couldn't find the wrongly created procedure. In my application I had also neglected the schema but didn't pick up on that right away. As you can imagine, any changes I made to the procedure with the correct schema were not reflected in the one under the dbo schema or in my application! I'm still trying to get the egg off of my face.
What you don't know can hurt you!
|