Solved

sas-update

Posted on 2012-04-11
3
298 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What should be a storage size for SQL in day1, day2 and day 3 7 91
Need a replacement data type in Oracle 6 77
SQL Query 34 97
T-SQL: Do I need CLUSTERED here? 13 37
APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…

816 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

12 Experts available now in Live!

Get 1:1 Help Now