• Hi BlackGarlic,

    First, my advice is that you post this to the T-SQL forum because this one on SqlServerCentral is for Integration services (SSIS) which is not as frequently visited as T-SQL, not to mention its for a different topic.

    Some suggestions (by no means am I an expert). But, first, if possible, I would copy/paste the select statement from sproc into another query editor window and execute the create #temp table first. Then I would, piecemeal, execute the other portion of that query up to and including it's first join to the #temp table.

    This should reveal the problem. Perhaps the join to the #temp table has a typo. This is valid initial approach that you may have already taken.

    I would do it and post the results of that investigation on the T-SQL forum.