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
43 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
ID: 41764585
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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