0

I'm getting an error:

MSG 4145: An expression of non-boolean type specified in a context where a condition is expected, near 'Left'.

Thoughts?

USE [DatabaseName]
GO
/****** Object:  StoredProcedure [dbo].[spFilePlanNavigate]    Script Date: 03/19/2015 14:54:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER Procedure [dbo].[spFilePlanNavigate](@CategoryId int) 
As 
Set NoCount On
Begin
    If @CategoryId > 0
        Select FilePlan.*, Retention.Retention_Type, Retention.Retn_Description1 
            From FilePlan, Retention 
            Where FilePlan.Retention_Code Left Outer Join Retention.Retention_Code 
                And FilePlan.Category_Id = @CategoryId
    Else
        Select FilePlan.*, Retention.Retention_Type, Retention.Retn_Description1 
            From FilePlan, Retention 
            Where FilePlan.Retention_Code Left Outer Join Retention.Retention_Code 
                And FilePlan.Category_Id_Parent = @CategoryId
End
Felix Pamittan
  • 31,544
  • 7
  • 41
  • 67
Kevin
  • 13
  • 2

1 Answers1

0

A left outer join is of this syntax:

select cola, colb from table1 left outer join table2 
on table1.id = table2.id 
where table.catid = @catid

Your sql statement is missing an 'on' clause.The 'on' clause tells SQL Server to match up the rows on the listed columns matching.

benjamin moskovits
  • 5,261
  • 1
  • 12
  • 22