
November 24th, 2004, 03:47 PM
|
|
Registered User
|
|
Join Date: Nov 2004
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Like in a null field
Hi everyone,
I need to create a stored procedure that receives 7 paramaters, 6 of them are optional. The problem is that I am using a LIKE @param1 and sometimes the value in the tables for this @param1 is NULL. If the value the user provides for @param1 is null, that row is not going to be selected as the LIKE '%' for a NULL value is not selected. I could check for each param if @param1 is null, but since there are 6 of them, it is not practical to do so. I also tried adding LIKE @param1 OR @param1 is null, but then it causes me a problem when a value is provided cause it selects all the rows that has @param1 as NULL!! I really don't know how to deal with this.
Using SQL Server 2000 and C# ASP.NET
Thank you!
|