Hi,
I have the following code
SET @sqlCommand = '
select
*
from
#temptable
where
SALES_OFFICE not in
(SELECT [SalesOfficeCode] from ' + (SELECT schema_name FROM #schema WHERE ROWNUMBER = @Init)
+ '.[DimSalesOffice]) and sales_division = ' + (SELECT schema_name FROM #schema WHERE ROWNUMBER = @Init)
However I am receiving the error
Invalid column name
The error seems to be related to the last part when is doing the comparison
sales_division = ' + (SELECT schema_name FROM #schema WHERE ROWNUMBER = @Init)
The part above that pulls the row value fine? Any ideas?