We have an sqr (running against a MS SQL Server DB), that references a dynamic temporary table variable in several begin-sql and begin-select statements. I am getting a syntax error in one begin-select statement where I can't resolve the problem. It occurs after the INNER JOIN on the [$Temp_Final_IDlist] temp table. It appears as if SQR doesn't see the replacement value for [$Temp_Final_IDlist].
I've already made sure that the variable is not empty.
Is there a limit in SQR on how many dynamic variables can be used in one program?
SQL = SELECT SEV_21A.ID,
FROM Salutation_Elements_View SEV_21A
[$Temp_Final_IDList] TFI_21A ON SEV_21A.ID = TFI_21A.ID
AND TFI_21A.DropIDFlag = 'N'
Salutation_Elements_View SEV_21B ON SEV_21A.HouseHoldKey = SEV_21B.HouseHoldKey
AND SEV_21A.HouseHoldCombineFlag = SEV_21B.HouseHoldCombineFlag
AND SEV_21A.EntityType = SEV_21B.EntityType
AND SEV_21A.SalutationType = SEV_21B.SalutationType
AND SEV_21A.OrderSeqNbrStd <> SEV_21B.OrderSeqNbrStd
AND SEV_21B.LastName IS NOT NULL
AND SEV_21B.StopDateTime IS NULL
AND SEV_21B.StopUserID IS NULL
WHERE SEV_21A.LastName IS NOT NULL
AND SEV_21A.OrderSeqNbrStd = 1
AND SEV_21A.HouseHoldCombineFlag = 'Y'
AND SEV_21A.SalutationType = 'A'
AND SEV_21A.StopDateTime IS NULL
AND SEV_21A.StopUserID IS NULL
ORDER BY SEV_21A.HouseHoldKey, SEV_21A.ID
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!