SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error With SQL Query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rds207
Posting Yak Master

198 Posts

Posted - 05/24/2010 :  20:34:35  Show Profile  Reply with Quote
Could you please let me why i am getting this error ?for the below code......

Msg 102, Level 15, State 1, Line 4
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 11
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 17
Incorrect syntax near ','.




SELECT     cm.*
FROM         CRMMetrics AS cm INNER JOIN
                      BatchRecords AS br ON cm.ApplicationJobID = br.JobName
WHERE     cm.Project = 'BMongr' AND cm.Type = 'Build' AND br.TerminationUser IS NULL AND br.EndTime IS NOT NULL), BuildRootsChildrenDuration AS
    (SELECT     br.ID AS ParentID, SUM(cm.NumSeconds) AS Duration
      FROM          CRMMetrics AS cm INNER JOIN
                             BuildRoots AS br ON cm.ParentID = br.ID
      GROUP BY br.ID), BuildRootsLeftover AS
    (SELECT     br.ID AS ID, br.NumSeconds - cd.Duration AS LeftoverDuration, cd.Duration AS ChildrenDuration
      FROM          BuildRootsChildrenDuration AS cd INNER JOIN
                             BuildRoots AS br ON (cd.ParentID = br.ID)), BuildOverheads AS
    (SELECT     cm.ApplicationID AS ApplicationID, cm.ApplicationJobID AS ApplicationJobID, 'Other' AS Type, NULL AS StartTime, 
                             LeftoverDuration AS NumSeconds
      FROM          CRMMetrics AS cm INNER JOIN
                             BuildRootsLeftover AS le ON cm.ID = le.ID)
    SELECT     ApplicationID AS BuildID, ApplicationJobID AS Jobname, Type AS Action, StartTime AS StartTime, NumSeconds AS Duration
     FROM         BuildOverheads
UNION
SELECT     br.ApplicationID AS BuildID, br.ApplicationJobID AS Jobname, cm.Type AS Action, DATEADD(SECOND, cm.StartTime, '1970-01-01') AS StartTime, 
                      cm.NumSeconds AS Duration
FROM         CRMMetrics AS cm INNER JOIN
                      BuildRoots AS br ON (cm.ParentID = br.ID OR
                      cm.ID = br.ID)

Edited by - rds207 on 05/24/2010 20:36:41

sql-programmers
Posting Yak Master

USA
190 Posts

Posted - 05/24/2010 :  23:46:44  Show Profile  Visit sql-programmers's Homepage  Reply with Quote
Send me the table structure or could you explain the purpose of using comma sepeartor in where condtion.

SQL Server Programmers and Consultants
http://www.sql-programmers.com/
Go to Top of Page

rds207
Posting Yak Master

198 Posts

Posted - 05/25/2010 :  00:00:51  Show Profile  Reply with Quote
I am just trying to understand the syntax of a view(someone created) , BatchRecords and CRMMETRICS are the table we have , when i select the data from the view i get it , but when i just copy the syntax and execute it , i get an error...........

I am unable to understand how a view can be generated from a query with syntax error...

quote:
Originally posted by sql-programmers

Send me the table structure or could you explain the purpose of using comma sepeartor in where condtion.

SQL Server Programmers and Consultants
http://www.sql-programmers.com/

Go to Top of Page

zstarsales04
Starting Member

20 Posts

Posted - 05/25/2010 :  02:13:14  Show Profile  Visit zstarsales04's Homepage  Reply with Quote
spam removed
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000