Solved

SQL Query Simple Not working where IF NOT EXISTS

Posted on 2014-11-17
3
131 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
[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
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

630 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