I have worked with DB2, and I just moved to the SQL Server. I'm a bit confused by a query.
Lets suppose I have table data like
StoreID | Sales
A | 23
B | 50
B | 50
In this data with the stored procedure parameter, I wanted to roll up the sum of Sales. I will get a parameter of StoreID, but in this parameter I can get 'ALL' too.
In DB2 I can get all data using a stored procedure (which has StoreID in a parameter named ParameterStore) with a query like
if(ParameterStore= 'ALL') Then
Set Loc_min = X'00';
Set Loc_max = X'FF';
ELSE
Set Loc_min = ParameterStore;
Set Loc_max = ParameterStore;
END if;
Select Sum(Sales) From Store_data where StoreID between Loc_min and Loc_max;
How can I do this in SQL Server to get the same result?