execute programmatically stored procedures with different parameter values
I have stored procedure getList(@date datetime)
how prog开发者_如何学Pythonrammatically execute stored procedure for differend datetime values.
datetime each month for 3 years.
You can try something like this
DECLARE @StartDate DATETIME,
@EndDate DATETIME
SELECT @StartDate = '01 Jan 2005',
@EndDate = '31 Dec 2007'
WHILE @StartDate <= @EndDate
BEGIN
PRINT @StartDate
EXEC getList(@StartDate)
SET @StartDate = DATEADD(mm, 1, @StartDate)
END
Just add one month to the current date?
DATEADD(month, 1, GETDATE())
精彩评论