Nested if statements in SQL Server stored procedure SELECT statement
问题 I'm new here, and relatively new to stored procedures, so please bear with me! I've checked related questions on here and can't find anything that works in this instance. I am trying to build a stored procedure (MS SQL Server 2005) that takes a number of passed in values and in effect dynamically builds up the SQL as you would with inline SQL. This is where I've come unstuck. We have (somewhat simplified for clarity): @searchf1 varchar(100), -- search filter 1 @searchr1 varchar(100), --