开发者

execute programmatically stored procedures with different parameter values

开发者 https://www.devze.com 2022-12-13 17:16 出处:网络
I have stored procedure getList(@date datetime) how prog开发者_如何学Pythonrammatically execute stored procedure for differend datetime 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

精彩评论

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