• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 60
  • Last Modified:

I am having an issue with a SQL Statement WHERE Clause in SQL Server 2008, I get the message "incorrect syntax near '=' ?

I am using SQL Server 2008 and I suspect I need to replace part of my SQL Statement WHERE clause:

WHERE StopVoidPay.userid = tbl_CSL_users.msidOld))= False))
with
WHERE StopVoidPay.userid != tbl_CSL_users.msidOld))

but I get confused with the placement of opening and closing parenthesis as follows:

SELECT
bank.entity,
tbl_CSL_StopVoidPay.bank,
tbl_CSL_StopVoidPay.userid,
tbl_CSL_StopVoidPay.dtCreated,
tbl_CSL_StopVoidPay.chkNum,
tbl_CSL_StopVoidPay.branch,
tbl_CSL_StopVoidPay.chkDt,
tbl_CSL_StopVoidPay.accountNum,
tbl_CSL_StopVoidPay.amount,
tbl_CSL_StopVoidPay.typeSV
FROM tbl_CSL_bank INNER JOIN tbl_CSL_StopVoidPay ON tbl_CSL_bank.bankID = tbl_CSL_StopVoidPay.bank
WHERE (((tbl_CSL_StopVoidPay.typeSV)='S') AND
((Exists (SELECT msidOld
FROM tbl_CSL_users
WHERE StopVoidPay.userid = tbl_CSL_users.msidOld))= False))   <---- Line 16
ORDER BY StopVoidPay.chkNum;

Msg 102, Level 15, State 1, Line 16
Incorrect syntax near '='.

Do you know how I can resolve this?
0
zimmer9
Asked:
zimmer9
1 Solution
 
Dale FyeCommented:
Try:

WHERE (tbl_CSL_StopVoidPay.typeSV = 'S')
AND NOT EXISTS (
SELECT msidOld
FROM tbl_CSL_users
WHERE StopVoidPay.userid = tbl_CSL_users.msidOld)
ORDER BY StopVoidPay.ChkNum
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now