select
pm.pmnum,
dateadd(MONTH,pm.frequency,pm.nextdate) as calcNEXTDATE
from pm
...
Can someone help me increment the results of the above, until lets say calcNEXTDATE = 2014-31-12?
select
pm.pmnum,
dateadd(MONTH,pm.frequency,pm.nextdate) as calcNEXTDATE
from pm
...
Can someone help me increment the results of the above, until lets say calcNEXTDATE = 2014-31-12?
如果这是您要查找的内容,您可以创建一个 while 循环来增加天数并添加到表中。因为你的问题包括循环、日期和增量的标签,所以你可以这样
CREATE TABLE #TestTable1
(
Col DATETIME
);
DECLARE @VarDate Datetime = GETDATE()
WHILE @VarDate <= '2014-12-31 00:00:00.000'
BEGIN
INSERT INTO #TestTable1(Col)
VALUES (@VarDate)
SET @VarDate = DATEADD(DAY, 1, @VarDate)
END