[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Incorrect Syntax error - Please heeelp!

Posted on 2009-04-07
7
Medium Priority
?
173 Views
Last Modified: 2012-05-06
Dear experts,

I am using SQL  Server 2005 to code the following query but I just kept getting the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'a'.

What am I doing wrong?

Any help is greatly appreciated.
SELECT 
  (SELECT COUNT(*)FROM tblMaster a,tblCODE cWHERE a.chsid=c.chsid and (c.Close_EmployedWhenReleased)='Y' and c. Start_Date > NULL and c. Start_Date < NULL and c. Close_Date > NULL and c.Close_Date < NULL ) AS A, 
 
(SELECT COUNT(*) FROM tblMaster a, tblCODE c WHERE a.chsid=c.chsid and UPPER(c.Close_RecvdJobTraining)='Y' and c.Start_Date > NULL and c. Start_Date < NULL and c.Close_Date > NULL and c. Close_Date < NULL ) AS B,
 
 (SELECT COUNT(*) FROM tblMaster a, tblCODE c WHERE a.chsid=c.chsid and UPPER(c.Close_OffPublicAssistance)='YES' and c. Start_Date > NULL and c.Setup_ Start_Date < NULL and c. Close_Date > NULL and c. Close_Date < NULL ) AS C
FROM xsystbl_SYSPARMS

Open in new window

0
Comment
Question by:sammySeltzer
[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
  • 3
  • 3
7 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 100 total points
ID: 24091363
line 2:

 (SELECT COUNT(*)FROM tblMaster a,tblCODE cWHERE a.chsid=c.chsid and (c.Close_EmployedWhenReleased)='Y' and c. Start_Date > NULL and c. Start_Date < NULL and c. Close_Date > NULL and c.Close_Date < NULL ) AS A,

should be:

 (SELECT COUNT(*)FROM tblMaster a,tblCODE c WHERE a.chsid=c.chsid and (c.Close_EmployedWhenReleased)='Y' and c. Start_Date > NULL and c. Start_Date < NULL and c. Close_Date > NULL and c.Close_Date < NULL ) AS A,

change:
"cWHERE" changed to "c where"
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 24091368
SELECT
  (SELECT COUNT(*)FROM tblMaster a,tblCODE c WHERE a.chsid=c.chsid and (c.Close_EmployedWhenReleased)='Y' and c. Start_Date > NULL and c. Start_Date < NULL and c. Close_Date > NULL and c.Close_Date < NULL ) AS A,
 
(SELECT COUNT(*) FROM tblMaster a, tblCODE c WHERE a.chsid=c.chsid and UPPER(c.Close_RecvdJobTraining)='Y' and c.Start_Date > NULL and c. Start_Date < NULL and c.Close_Date > NULL and c. Close_Date < NULL ) AS B,
 
 (SELECT COUNT(*) FROM tblMaster a, tblCODE c WHERE a.chsid=c.chsid and UPPER(c.Close_OffPublicAssistance)='YES' and c. Start_Date > NULL and c.Setup_Start_Date < NULL and c. Close_Date > NULL and c. Close_Date < NULL ) AS C
FROM xsystbl_SYSPARMS
0
 
LVL 29

Author Comment

by:sammySeltzer
ID: 24091464
chapmandew:

It worked great but what did I do wrong?

I don't see it please forgive my slow uptake.

Thanks very much.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 60

Assisted Solution

by:chapmandew
chapmandew earned 100 total points
ID: 24091487
couple of things...

first, was here:  (*)FROM tblMaster a,tblCODE cWHERE a.chsid=c.

your c blended with your WHERE

second was here:
and c.Setup_Start_Date < NULL and c. Close_Date > NULL and c. Close_Date < NULL ) AS C

there was  space between c. and Close_Date
0
 
LVL 29

Author Comment

by:sammySeltzer
ID: 24091549
thanks very much
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 24091565
welcome
0
 
LVL 29

Author Comment

by:sammySeltzer
ID: 24130952
I thought I closed this thread.

Sorry guys.

Again, thanks a lot BrandonGalderisi: and chapmandew:

Any of your solutions would have worked for me.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

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 …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

656 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