如何自动传播日期表? [英] How to propagate date table automatically?
本文介绍了如何自动传播日期表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一张包含一系列日期的表格。我想要做的是采取表格中的最后一个日期并传播接下来的52周。关于如何做到这一点,我没有任何线索。我知道我需要一个循环结构来计算52个循环,但我丢失的是如何进行循环功能。
我的表很简单:
ID(Autonum)|日期值(smalldatetime)
是循环次数= 52?
I have a table with a series of dates. What I want to do is take the very last date in the table and propagate the next 52 weeks. I don''t have any clues as to how to do this. I know I''ll need a loop structure to count 52 loops but where I''m lost is how to do the loop function.
My table is very simple:
ID (Autonum) | Datevalue (smalldatetime)
is loop count = 52?
如果是,则退出
如果没有则开始循环
If yes quit
if no then begin loop
展开 | 选择 | Wrap | 行号
推荐答案
我得到了此代码片段,用于生成一系列连续的数字。您可以使用此技术并将其修改为INSERT语句。
快乐编码!!!
~~ CK
I got this snippet of code to generate a sequential series of number. You can use this technique and modify it into an INSERT statement.
Happy Coding!!!
~~ CK
非常酷,这有帮助。现在,我还有一些工作要做,也许这里有人可以帮我做。我现在想要做的是在这个查询中增加两个字段:月份编号总是连续的,一个人编号从1到6.这是我到目前为止所拥有的:
Very cool, that helped. Now, I have some further work to do that perhaps maybe someone here can help me do. What I want to do now is add two more fields to this query: the month number which is always sequential and a person id from 1 to 6. Here''s what i have so far:
展开 | 选择 | Wrap | 行号
我已经确定了月号字段是不必要的。所以现在我的情况就是将人员ID添加到日程表中。我知道它会成为另一个循环,但我遇到的一个重要问题是这个循环应该放在哪里?
I have decided the month number field is unnecessary. So now my situation is just adding the person id to the schedule. I know its going to be another loop but the big question I have is where should this loop sit?
这篇关于如何自动传播日期表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文