How can I declare int array in SQL Server?
After fill it, I would like to use it in IN statement to check, how can I change my code?
declare @mode int =1
declare @acceptedFormTypeIds table (id int)
case @mode
when 1 then
insert into @acceptedFormTypeIds(id) values (1, 2, 3, 4)
when 2 then
insert into @acceptedFormTypeIds(id) values (1, 3)
when 3 then
insert into @acceptedFormTypeIds(id) values (2, 4)
else
insert into @acceptedFormTypeIds(id) values (1, 2, 3, 4)
end
...
WHERE
tFRM.SendDate between @datefrom and @dateto
and tFRM.TemplateId IN @acceptedFormTypeIds.id