SQL Server : set variables with an if statement -


i 2 values passed variables:

@f_start_date_dt varchar(50) @f_end_date_dt varchar(50) 

and have other parameter declarated:

declare @ssql nvarchar(4000) 

i check if first 2 variables null , correctly:

select case when @f_start_date_dt or @f_end_date_dt null  set @ssql = 'select * test_sql1' else set @ssql = 'select * test_sql2' end 

something suffice.

if @f_start_date_dt null or @f_end_date_dt null     begin         set @ssql = 'select * test_sql1'     end else     begin         set @ssql = 'select * test_sql2'     end 

Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

php - Mongodb connectivity error -