簡體   English   中英

用一個光標填充事實表和時間表

[英]populate a fact table and time table with one cursor

任何人都可以告訴我如何用一個光標填充事實表和時間表。 表格如下,

DW_TERM_FACT TABLE

TERM_ID
BRANCH_ID
TEMPREQUEST_ID
TEMPCOVER_ID
TEMP_ID
STATUS
TERMDATE

DW_時間表

TIME_ID
TDATE
TWEEK
TMONTH
TYEAR

非常感謝

按照下面的說明,您應該沒問題。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM