开发者

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())
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜