Hi baijupep,
this is too can be acheived by Where condition.
I can not give you the query you required but the idea.
DECLARE @Customer TABLE
(
Id INT
,City VARCHAR(100)
,Name VARCHAR(100)
)
INSERT INTO @Customer
SELECT 1,'Mumbai','Rk_hirpara'
UNION ALL
SELECT 2,'Mumbai','Imran Khan'
UNION ALL
SELECT 3,'Newyork','Mark John'
UNION ALL
SELECT 4,'Surat','Om Ukani'
UNION ALL
SELECT 5,'Surat','Manthan Kikani'
DECLARE @City VARCHAR(100) = NULL, @name VARCHAR(100) = NULL
SET @City = 'Surat'
SET @name = 'Om Ukani'
SELECT * FROM @Customer
WHERE (@City IS NULL OR City = @City) AND (@name IS NULL OR Name = @name)
comment either of set statement or both and look at result.
this is some think like you should do for your code.
Thanks and Regards,
Rk_Hirpara