Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
58 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 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