I'm running into a very strange error with temp tables and some SQL stored procedures. For the past couple days, the only error I've been able to get is "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
After raising the threshold for a timeout in C# (from 30 seconds to 120 seconds), I'm now getting this error:
"Invalid column name 'CoverageLimit'.
Invalid column name 'Difference_Options'.
Invalid column name 'CoverageLimit'.
Invalid column name 'CoverageLimit'.
Invalid column name 'CoverageLimit'.
Invalid column name 'CoverageLimit'.
Invalid column name 'CoverageLimit'.
Invalid column name 'CoverageLimit'.
Invalid column name 'Difference_Options'.
Invalid column name 'Difference_Options'.
Invalid column name 'CoverageLimit'."
However, these columns do not exist in the temp table referenced in the stored procedure called in the function that the stack trace is hitting.
CREATE TABLE [dbo].[#TEMP]
(
FormEndorsementID [int] NOT NULL,
[Restriction] bit,
[Description] nvarchar(3000),
[Type] nvarchar(255),
[QQ_Reference] nvarchar(255),
[Values] nvarchar(255)
) ON [PRIMARY]
I was quite confused by this, so I executed a query to find any instances of CoverageLimit
or Difference_Options
in stored procedures, and ended up finding this temp table in two completely different stored procedure:
CREATE TABLE [dbo].[#TEMP]
(
OptionID [int] IDENTITY(1,1) NOT NULL,
CoverageLimit int,
Difference_Options int
) ON [PRIMARY]
(Note: I wasn't the one who set up this database schema. It is in severe need of cleanup/updating.)
Now, could there be an issue of some kind of scope? The strangest part about this is that we have this same application running on a different server with the same databases, and it's not encountering this error.
Thanks!