Solved

sas-update

Posted on 2012-04-11
3
297 Views
Last Modified: 2012-04-20
hi,
i am upating a table using table loader which works fine if i run very first time and populate
column as (| Emp: (aa, bb (00846XXX); aa, bb (07041XXX))

if i run it again this column gets dups as
(| Emp: (aa, bb (00846XXX); aa, bb (07041XXX))(| Emp: (aa, bb (00846XXX); aa, bb (07041XXX))

i don't want that if it sees | Emp: string don't update that column just skip it.



proc sql ;
         /* update existing records in the master table  */
         update QSMRTPDI.EXCP_FCT as m
            set EXCP_ADDTL_INFO_TEXT = (select EXCP_ADDTL_INFO_TEXT from &etls_lastTable as t
                                where m.ITEM_ID = t.ITEM_ID and
                                      m.EXCP_TYP_CDE = t.EXCP_TYP_CDE and
                                      m.WC_ID = t.WC_ID and
                                      m.SVCTKT_NUM = t.SVCTKT_NUM and
                                      m.EXCP_EVT_DTE = t.EXCP_EVT_DTE and
                                      m.EXCP_EVT_TME = t.EXCP_EVT_TME)
               where ITEM_ID in (select distinct ITEM_ID from &etls_lastTable) and
                        EXCP_TYP_CDE in (select distinct EXCP_TYP_CDE from &etls_lastTable) and
                        WC_ID in (select distinct WC_ID from &etls_lastTable) and
                        SVCTKT_NUM in (select distinct SVCTKT_NUM from &etls_lastTable) and
                        EXCP_EVT_DTE in (select distinct EXCP_EVT_DTE from &etls_lastTable) and
                        EXCP_EVT_TME in (select distinct EXCP_EVT_TME from &etls_lastTable)
         ;
         
      quit;
0
Comment
Question by:sam2929
  • 2
3 Comments
 
LVL 6

Expert Comment

by:wshark83
ID: 37832319
i assume "| Emp: " is in EXCP_ADDTL_INFO_TEXT field

then you can add an additional and statement to say

substr(EXCP_ADDTL_INFO_TEXT,1,6) ne "| Emp:"
0
 

Author Comment

by:sam2929
ID: 37832794
yes we can but it can be 1,6 i not fixed can we use index stmt
0
 
LVL 6

Accepted Solution

by:
wshark83 earned 500 total points
ID: 37833157
yes you can use the index function index(EXCP_ADDTL_INFO_TEXT,"| Emp:") = 0
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now