How to show NULL results from query? 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
ALTER PROCEDURE dbo.SEARCH_QUERYS -- always use schema prefix!
        @ID   int,
        @LIVE bit,
        @DATA datetime
AS
BEGIN
        SELECT ID, LIVE, DATA --, ... don't use SELECT *!
        FROM dbo.TB_SEARCH -- always use schema prefix!
        WHERE 
        (ID = @ID OR @ID IS NULL)
        AND (LIVE = @LIVE OR @LIVE IS NULL)
        AND (DATA = @DATA OR @DATA IS NULL); -- always use semi-colons!
END
GO


In some cases though you are better off building the query dynamically.

Refs:


Not using SELECT *
Using schema prefix
Using statement terminators