MartinCroft
Programmer
Hi
I have the following bit of code in a where clause
(@BranchID is null or BranchID = @BranchID)
This will cause a clustered index scan where
(BranchID = @BranchID)
does a clustered index seek.
I am sure there is another way of doing the search so if a null @branchID value is passed it returns all values, tried COALESCE and ISNULL but my heads not working today, I am sure there is a way of doing this and I dont want to use dynamic SQL
Mart
I have the following bit of code in a where clause
(@BranchID is null or BranchID = @BranchID)
This will cause a clustered index scan where
(BranchID = @BranchID)
does a clustered index seek.
I am sure there is another way of doing the search so if a null @branchID value is passed it returns all values, tried COALESCE and ISNULL but my heads not working today, I am sure there is a way of doing this and I dont want to use dynamic SQL
Mart