Filter no null rows using WHERE clause

SELECT        BC_ID, Procedure_Description, Test_result, Normal_Values
FROM            tbl_BC
WHERE        (NOT (Test_result LIKE '@Test_result = %'))

Hello.

I want to filter all not null in Test_result row, but with the code above all records in the datagridview will hide.

Upvotes: 0

Views: 32

Answers (1)

Dai
Dai

Reputation: 155145

Your question is unclear, but I think you want to ensure that NULL values are not included in your results.

Use IS NOT NULL to filter NULL values in T-SQL:

SELECT
    BC_ID,
    Procedure_Description,
    Test_Result,
    Normal_Values
FROM
    tbl_BC
WHERE
    Test_Result NOT LIKE @Test_Result + '%'
    AND
    TestResult IS NOT NULL

Upvotes: 1

Related Questions