Japhet Batucan Japhet Batucan - 4 months ago 16
Vb.net Question

How to filter null column in rows

CREATE PROCEDURE [dbo].[25]
@param1 int
AS
SELECT c.Name, c.Age, c2.Name, c2.Country
FROM Cus C
INNER JOIN Cus2 C2 ON c.id = c2.id
WHERE c2.country is not null and c2.id = @param1
ORDER BY c2.Country

RETURN 0


Above is my stored procedure.

What I want to happened is to filtered those rows who has a null column and only display those rows with a string value in that particular column.

I want it to display in RDLC. In my current store procedure it will not filter out the null row's column.

Answer
CREATE PROCEDURE [dbo].[25]
    @param1 int
AS
    SELECT c.Name, c.Age, c2.Name, c2.Country
    FROM Cus C 
    INNER JOIN Cus2 C2 ON c.id = c2.id
    WHERE (c2.Country <> '') and (c2.id = @param1)
    ORDER BY c2.Country 

RETURN 0

I just see the answer from another post. Thanks to those people who helped me.

Comments