Hi guys, I'm trying to convert the following T-SQL query to x++:
INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3) SELECT @VARIABLE1 AS COLUMN1, @VARIABLE2 AS COLUMN2, TABLE2.COLUMN3 AS COLUMN3 FROM #TABLE2 TABLE2 LEFT JOIN TABLE1 WITH (NOLOCK) ON TABLE1.COLUMN1 = TABLE2.COLUMN1 AND TABLE1.COLUMN2 = @SOMEVARIABLE WHERE TABLE1.COLUMN3 IS NULL
but when I wrote it in x++, it came out like this:
while select column3 from table2 where table1.column3 == '' outer join table1 where table1.column1 == table2.column1 && table1.column2 == someVariable { table1.column1 = variable1; table1.column2 = variable2; table1.column3 = table2.column3; insertRecordList.Add(table1); } insertRecordList.insertDatabase();
Which I'm pretty sure it's wrong because it won't filter on that first 'where' clause, as the table buffer is still empty at that point (I believe).
What would be the appropriate way to translate that to x++? Am I approaching this the wrong way?
*This post is locked for comments