任何人都可以告诉我如何使用一个光标填充事实表和时间表。表格如下,
DW_TERM_FACT 表
TERM_ID
BRANCH_ID
TEMPREQUEST_ID
TEMPCOVER_ID
TEMP_ID
STATUS
TERMDATE
DW_TIME 表
TIME_ID
TDATE
TWEEK
TMONTH
TYEAR
非常感谢你
答案 0 :(得分:0)
按照下面你应该没问题。
declare Cur_Details cursor
for
--select your details you will be populating from
open Cur_Details
fetch next from Cur_Details
into -- insert into your variables that you will use
while @@Fetch_Status = 0
Begin
if -- your variable meets your criteria you can begin your table population
Begin
--populate your tables using variables that you populated from cursor
End
Fetch next from Cur_Details
into -- insert into your variables that you will use
End
close Cur_Details
deallocate Cur_Details