Created
July 12, 2018 13:13
-
-
Save alikrc/58fa92ab6f09c7d275462923324f8f37 to your computer and use it in GitHub Desktop.
If param is not null then add to where clause
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare | |
@id int--=123 | |
select @id | |
select * from FOOTABLE t | |
where | |
(@id is null or t.ID = @id) --if param is null it doesnt add the condition | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment