robbydogg
New member
- Joined
- Sep 3, 2010
- Messages
- 4
- Programming Experience
- Beginner
Hello,
I am trying to set up a job which executes some stored procedures with preset variables.
I am trying to get the preset variables to show last month's month number and current year, but when going into jan next year, for it to be december of the previous year.
below is the code i have used but it doesn't seem to work - can anyone help?
the code below, shoudl set the variables @PRD to 8 and @Year to 2010 and then 'send them into' the stored procedure called ASP.
thanks in advance
I am trying to set up a job which executes some stored procedures with preset variables.
I am trying to get the preset variables to show last month's month number and current year, but when going into jan next year, for it to be december of the previous year.
below is the code i have used but it doesn't seem to work - can anyone help?
the code below, shoudl set the variables @PRD to 8 and @Year to 2010 and then 'send them into' the stored procedure called ASP.
VB.NET:
declare @PRD int
select case
when month(getdate()) = '1' then '12'
else month(getdate())
end
declare @Year int
select case
when month(getdate()) = '1' then year(getdate())-1
else year(getdate())
end
exec asp
@PRD = @PRD, @YEAR=@YEAR
thanks in advance