I want to ask If is possible to combine SQL queries at runtime.
Lets say I have a stored procedure with parameters @type(int), @name(varchar(50))=null and @dept(varchar(50))=null.
Now I have a query Select * from Employees.
My question is can I dynamically add something like where name = @name when @type = 1 or where dept = @dept when @type = 2
you can write