>Here is my syntax:
>
>Declare @ProjFLIDSearch varchar(4),
> @ProjFLID int
>
>Set @ProjFLID = 0
>
>if @ProjFLID = 0
> begin
> set @ProjFLIDSearch = '%'
> end
>else
> begin
> set @ProjFLIDSearch = @ProjFLID
> end
>
>Select *
>From Table Where Table.ProjFLID like @ProjFLIDSearch
>
>If @ProjFLID = 0 this will return all records , but will exclude NULL values that are in Table.ProjFLID
>How do we include the null values.?
>
>if @ProjFLID > 0 then it should only bring back that record specified
Mike,
Just do two separate select statements instead, e.g.
>if @ProjFLID = 0
> begin
> Select * From Table end
>else
> begin
Select *
From Table Where Table.ProjFLID like @ProjFLIDSearch
> end
>
If it's not broken, fix it until it is.
My Blog