We are modifying a report that allow users to select just one value from 1 to 13 (numeric). (No multiple selections allowed.)
I would like to name this parameter as @n
The value is based on this similar query.
Select DateAdd(Month, 3, @StartDate)
The original declaration is:
DECLARE @StartDate AS DateTime
Set @StartDate = DateAdd(Month, DateDiff(Month, 0, GetDate()) - 1, 0)
-------------------------------------------------
The ideal query is like this:
Select DateAdd(Month, @n, @StartDate)
User will be prompted to select a parameter value from 1 to 13. If I select 5, it will be equivalent to:
Select DateAdd(Month, 5, @StartDate)
Then, this query will be executed based on the value selected.
I declare @n as numeric. If it was incorrect, please let me know. Thanks.
---------------------------------------
When I first declared and executed, it failed on scalar value.
Declare @n as numeric
--Set @n ???? --- Please advise.