Solved

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

Posted on 2016-08-21
1
32 Views
Last Modified: 2016-08-21
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
Comment
Question by:zimmer9
1 Comment
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
Comment Utility
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now