• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

SINTAX ERROR IN SP

HELLO EXPORTS. ATTACHED IS THE SP I'M HAVING TROUBLE WITH.
THANKS  
SP.txt
0
lancerxe
Asked:
lancerxe
  • 4
  • 3
1 Solution
 
rajvjaCommented:
Hi,

   Which line you are getting error. I guess, the syntax for identity column is Id INT IDENTITY(1,1) NOT NULL PRIMARY KEY

If not, post the line
0
 
lancerxeAuthor Commented:
IF (@Project  = 'SmartCare')
0
 
rajvjaCommented:
Where is the END statement for WHILE loop
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
lancerxeAuthor Commented:
error mesaage
Msg 156, Level 15, State 1, Procedure usp_QA_Defects_1_Business_Area, Line 80
Incorrect syntax near the keyword 'IF'.
Msg 156, Level 15, State 1, Procedure usp_QA_Defects_1_Business_Area, Line 110
Incorrect syntax near the keyword 'AND'.
0
 
rajvjaCommented:
Hi,

      INSERT STATEMENT should be inside IF STATEMENT

Otherwise it is assuming that VALUES caluse but fount IF statement
0
 
rajvjaCommented:

SELECT @Month = Month FROM dbo.QA_MonthIDLookup
            WHERE MonthID = @MonthID
       
          
       
--Calculate bugs
IF (@Project  = 'SmartCare')
        INSERT INTO tmpQA_Defects1BusinessArea(MonthYear, BusinessArea, NumOfDefects)
            SELECT
            @Month AS MonthYear, i.Project As BusinessArea, COUNT(*) AS BugNum
            FROM dbo.Bug b  
            INNER JOIN dbo.Iteration i ON i.IterationID = b.IterationID          
               
            WHERE(b.Latest = 1)
            AND b.Deleted = 0
            AND b.CollectionID = 2
            AND i.Project = @Project
            AND RTRIM(convert(char(2),DATEPART(M,DateCreated))) + '/' + convert(char(4),DATEPART(YEAR,DateCreated)) = @Month
         
            AND ((b.State = 'Active' AND  b.Triage = 'Triaged') OR b.State = 'Closed')
            GROUP BY i.Project

ELSE IF(...)
0
 
lancerxeAuthor Commented:
i will try that. thanks rajvja.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now