Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Scalar (Error)..Pliz Help

Author  Topic 

Bright
Starting Member

4 Posts

Posted - 2014-04-09 : 09:22:09
I tried google, but cant't get information on how to solve my specific problem....
ERROR......Msg 137, Level 15, State 2, Line 15
Must declare the scalar variable "@PathID".

Below is my SQL query





SELECT C.CourseID AS Course,COUNT(D.EventTypeID)AS Eventstotal

FROM dbo.ADFPath P
LEFT OUTER JOIN dbo.ADFCourse C
ON P.PathID = C.PathID
LEFT OUTER JOIN dbo.ADFSection S
ON C.CourseID = S.CourseID
LEFT OUTER JOIN dbo.ADF_Event E
ON S.SectionID = E.SectionID
LEFT OUTER JOIN dbo.ADF_Document D
ON E.DocumentID = D.DocumentID
LEFT OUTER JOIN dbo.ADF_EventType T
ON D.EventTypeID = T.EventTypeID

WHERE (P.PathID =@PathID)
AND(C.CourseID = @CourseID)
AND(S.SectionID=@SectionID) AND
(D.EventTypeID=@EventTypeID
GROUP BY C.CourseID
ORDER BY COUNT(D.EventTypeID) DESC

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2014-04-09 : 09:30:00
http://technet.microsoft.com/en-us/library/ms188927.aspx


Too old to Rock'n'Roll too young to die.
Go to Top of Page
   

- Advertisement -