Cannot call methods on uniqueidentifier

Soluga
Soluga used Ask the Experts™
on
Hi,

When I try to run the stored proc below, I keep getting the error "Cannot call methods on uniqueidentifier."

This is to do with my AND statement. All the id's are uniqueidentifiers.

Would be grateful for any help.

Thanks
alter PROCEDURE usp_M05_GetAllOptionalWorkgroups
	-- Add the parameters for the stored procedure here
	@onlineCourseID Uniqueidentifier
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    SELECT     tbl_M04_Wgs.WorkgroupID, tbl_M04_Wgs.WorkGroupName, CONVERT(Int, tbl_M04_Wgs.WorkGroupStatus) AS Status, tbl_M05_OCOWA.OptionalAssignmentID
FROM         tbl_M04_Workgroups AS tbl_M04_Wgs LEFT OUTER JOIN
                      tbl_M05_OnlineCourseOptionalWorkGroupAssignments AS tbl_M05_OCOWA ON tbl_M04_Wgs.WorkgroupID = tbl_M05_OCOWA.OptionalWorkGroupID
WHERE     (tbl_M04_Wgs.WorkGroupStatus = '1') AND (tbl_M04_Wgs.WorkgroupID.WorkgroupID NOT IN
                          (SELECT     MandatoryWorkGroupID
                            FROM          tbl_M05_OnlineCourseMandatoryWorkGroupAssignments AS tbl_M05_OCMWA
                            WHERE      (MandatoryWorkGroupID = @onlineCourseID)))
ORDER BY tbl_M04_Wgs.WorkGroupName

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Engineer
Top Expert 2011
Commented:
your problem is here : AND (tbl_M04_Wgs.WorkgroupID.WorkgroupID
Imran Javed ZiaConsultant Software Engineer - .NET Architect

Commented:
Please try it as following:

alter PROCEDURE usp_M05_GetAllOptionalWorkgroups  
        -- Add the parameters for the stored procedure here  
        @onlineCourseID Uniqueidentifier  
AS  
        -- SET NOCOUNT ON added to prevent extra result sets from  
        -- interfering with SELECT statements.  
        SET NOCOUNT ON;  
 
    SELECT     tbl_M04_Wgs.WorkgroupID, tbl_M04_Wgs.WorkGroupName, CONVERT(Int, tbl_M04_Wgs.WorkGroupStatus) AS Status, tbl_M05_OCOWA.OptionalAssignmentID  
FROM         tbl_M04_Workgroups AS tbl_M04_Wgs
      LEFT OUTER JOIN tbl_M05_OnlineCourseOptionalWorkGroupAssignments AS tbl_M05_OCOWA
      ON tbl_M04_Wgs.WorkgroupID = tbl_M05_OCOWA.OptionalWorkGroupID  
WHERE     (tbl_M04_Wgs.WorkGroupStatus = '1')
AND (tbl_M04_Wgs.WorkgroupID.WorkgroupID NOT IN  
                          (SELECT     MandatoryWorkGroupID  
                            FROM          tbl_M05_OnlineCourseMandatoryWorkGroupAssignments AS tbl_M05_OCMWA  
                            WHERE      (MandatoryWorkGroupID = @onlineCourseID)))  
ORDER BY tbl_M04_Wgs.WorkGroupName

Author

Commented:
Doh!

Flipping heck, I've been lookint at it for ages lol

Cheers

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial