declare @Search_String nvarchar(50);
set @Search_String =null
select * from Punnu1 where Column11 like case 
when @Search_String is null then '%%'
else '%'+@Search_String+'%'
end

i have a query like this . but this does not take any element
in column1 with values null.
what should i do to take query with values null in Column11
With thanks in advance
Punnoose

Do you want to select null values when searchstring is null ?

SELECT * FROM Punnu1 WHERE Column11 LIKE
  CASE 
    WHEN @Search_String IS NULL THEN NULL 
    ELSE '%'+@Search_String+'%'
  END

Although I think LIKE NULL does not return any NULL columns. The problem with the case is that you can use it only for values, not constructs. Perhaps you should explain better what you are trying to achieve, then we can fix the query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.