i'm trying to create a procedure with filters for search.
If the parameter is "NULL" the value of parameter will be column value;
Here my problem: When my parameter and column value is NULL.
I have no results because of this.
I know that query: "COLUMN_NAME IS NULL" return the result even if the value is NULL, but i don't know how to implement this.
I trying to do this with "CASE" but without success.
CREATE PROCEDURE SEARCH_QUERYS @ID int, @LIVE bit, @DATA datetime AS BEGIN SELECT * FROM TB_SEARCH WHERE ID = ISNULL(@ID,ID) AND LIVE = ISNULL(@LIVE,LIVE) AND DATA = ISNULL(@DATA,DATA) END