2013-03-21 92 views
1

enter image description here級聯日期和字符串在Excel

在Excel我使用以下公式: -

="Select Count(1) Into Count1 From TRB_TPOAR Where tpo_id='" & A2 & "' and eta_id=old_eta_id and date_creation=to_date('" & B2 & "','dd/mm/yyyy HH24:MI:SS') and UTL1_EDS_ID='DEI037'; 
    if Count1>0 then 
    Update TRB_TPOAR Set Eta_id=new_eta_id Where tpo_id='" & A2 & "' and eta_id=old_eta_id and date_creation=to_date('" & B2 & "','dd/mm/yyyy HH24:MI:SS') and UTL1_EDS_ID='DEI037'; 
    DBMS_OUTPUT.PUT_LINE('" & A2 & "' UPDATED'); 
    end if;" 

在excel表B欄包含的日期時間信息(例如,2013年1月14日12時20分01秒PM),但是當我應用公式時,它增加了一些其他的數值。任何人都可以幫助我,在上述公式中做出什麼改變?

+0

您使用Excel公式建立一條SQL語句,對不對? – 2013-03-21 10:12:50

+0

是的,實際上我必須在表格中插入1000條記錄,並且只有日期時間在每條記錄中發生變化 – F11 2013-03-21 10:14:26

回答

2

就你而言,Excel會返回引用單元格中日期的serila數字。要確保它返回一個字符串,以所需格式顯示日期,請使用=TEXT(cell, FormatString)
例如爲:TEXT(C2, "dd/mmm/yy")
博訥機會