Solved

SQL Query Simple Not working where IF NOT EXISTS

Posted on 2014-11-17
3
122 Views
Last Modified: 2014-11-17
I am scratching my head at this. I have one just like this working but cannot get it working.

IF NOT EXSITS(SELECT 1 FROM mfusers WHERE USERNAME='gashlin@gmail.com')
begin
INSERT INTO OUTLOOKREPORT.DBO.MFUSERS VALUES('','test@test.com', 'test','160488','bob smith','N')
end

Open in new window


returns this

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'SELECT'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ')'.

Open in new window

0
Comment
Question by:desiredforsome
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 40447909
Spelling mistake

IF NOT EXISTS
0
 

Author Comment

by:desiredforsome
ID: 40447924
OMG I CANT BELIVE I MISSED THAT. TIME FOR SOME REDBULL!!!
0
 

Author Closing Comment

by:desiredforsome
ID: 40447925
NEED ENERGY DRINK!
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.

Question has a verified solution.

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

In this article I will describe the Copy Database Wizard 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.
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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

23 Experts available now in Live!

Get 1:1 Help Now