Example to filter user records by name / email if both criteria have the value
DECLARE @Name varchar(20)
DECLARE @Email varchar(20)
SET @Name = 'user'
SET @Email = ''
select * from User
WHERE (@Name = '' OR userName = @Name)
AND (@Email = '' OR userEmail= @Email)
Sunday, May 15, 2011
MSSQL filter record with IF Statement
Posted by
Khairul
at
Sunday, May 15, 2011
Labels: MSSQL
