Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Query Simple Not working where IF NOT EXISTS

Posted on 2014-11-17
3
Medium Priority
?
134 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
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 Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

963 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