Solved

SQL Query Simple Not working where IF NOT EXISTS

Posted on 2014-11-17
3
120 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

13 Experts available now in Live!

Get 1:1 Help Now