Solved

SQL Query Simple Not working where IF NOT EXISTS

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

734 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