Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi,Another question from me.How to query with many "if" in the where clause, like example below:
select * from table1 t1where t1.a = 'text' and t1.b = 50 andif @par = 0 then t1.c = 1 and t1.z like '%text%'else if @par = 1 then t1.d = 1 and t1.z like '%text%'else if @par = 2 then t1.e = 1 and t1.z like '%text%'end