Reputation: 23
I have a code that looks like this
Select *
Into #DTemp
From
(Select A, B, C, D
From
T1 LEFT OUTER JOIN T2 ON T1.I=T2.I
LEFT OUTER JOIN
T3 ON T2.I = T3.I
....
T6 ON T5.I = T6.I
WHERE
A = 'THE'
AND B LIKE '%YYYY%
AND C >= (TIME)
)
But I get an error on the last parenthesis that says "Incorrect syntax near ')'.
Not sure why there's an error in there as my parenthesis are correct.
Upvotes: 1
Views: 223
Reputation: 8497
You are missing single quote after AND B LIKE '%YYYY%
this. and add alias name after closing )
Check arrow pointers in below code
Select *
Into #DTemp
From
(Select A, B, C, D
From
T1 LEFT OUTER JOIN T2 ON T1.I=T2.I
LEFT OUTER JOIN
T3 ON T2.I = T3.I
....
T6 ON T5.I = T6.I
WHERE
A = 'THE'
AND B LIKE '%YYYY%' //<---
AND C >= (TIME)
) tablenamehere //<---
Upvotes: 1