Help required for update SQL

Hi Guys,
I am looking for some help to frame the update query.
I have two tables temp_1 and temp_2.
I want to update temp_2 based on data from temp_1. However i do not want to make an update where temp_1 has null value.
One approach i can think of is creating two different update statements but is there any chance to get it done through
only one statement. Also i would like to add here that temP_1 has 250K data and i going to make update on approx 500K
rows from temp_2. So i need to look from performance point of view as well.
Temp_1                       temp_2
Col1   Col2  Col3        col1     col2    col3
1 abc   abc                  1        null    null
2 abc   null                  2         xyz     xyz
3 null  null                   3          xyz     null
After update i am looking forward to get data in below format.
temp_2
col1     col2    col3
1        abc     abc
2        abc     xyz
3        xyz     null  

USE TESTdb
go
create table express (col1 int, col2 varchar(25), col3 varchar(25))
go
create table express2 (col1 int, col2 varchar(25), col3 varchar(25))
go
insert into express values (1,'abc','abc'),(2,'abc',null),(3,null,null)
insert into express2 values (1,null,null),(2,'xyz','xyz'),(3,'xyz',null)
select * from express
select * from express2
update express2
set col2= case when x.col2 is null and e.col2 is not null then e.col2
else x.col2
end ,
col3= case when x.col3 is null and e.col3 is not null then e.col3
else x.col3
end
from express e inner join express2 x on e.col1=x.col1
--drop table express, express2
ebro

Similar Messages

  • Urgent help required for update Plz help!!

    Hi i am updating my E51 and its displaying updating software please wait estimated time left 15 minutes for the past 1 hour.
    Please tell me what should i do....
    Its really urgent pls help....

    Hi,
    There might be a problem with either the NSU or the phone itself. Any updates on what happened?
    Next time make sure you meet the certain system requirements before proceeding with the update.
    Message Edited by nj15 on 01-Oct-2008 01:44 PM

  • HT6030 I downloaded Mail Update for Mac OS X 10.5.6 and was told it could not be installed because it was from an unidentified developer.  Tried installing download from MailUpdate & advised the disk did not meet the requirements for update. Hmmmm.

    I downloaded Mail Update for Mac OS X 10.5.6 and was told it could not be installed because it was from an unidentified developer.  Tried installing download from MailUpdate & advised the disk did not meet the requirements for update.   Expect it's due to being at 10.9.1.  Mail is still teetering between dysfunctional and non-functional.  Advice?

    I'm not sure what "Mail Update for Mac OS X 10.5.6" is. Mac OS X 10.5.6 is Leopard, a system that is quite old at this point. There have not been any Mail updates for Leopard in quite some time. If you are trying to install some old Mail update for Mac OS X 10.5.6 in Mavericks, that won't work.
    If you are trying to install the Mavericks Mail update manually, that's not necessary if you have updated through the App Store. If the App Store shows no updates, you don't need this. (The error message doesn't make sense, and may indicate some other problem with your system, assuming that you were downloading this update from Apple's site.)
    I'd advise you to start a new topic in the Mavericks forum and describe the problems you are having with Mail. Be sure to include specifics, but try to avoid speculating on causes, as responses that may be related to an inaccurate assumption on your part can cloud the issue.

  • TS1814 I'm trying to update iTunes software, but when I go to Help/Check for updates, I continue to get the message: "The iTunes update server could not be contacted. Please check your Internet connection or try again later."  Is there another way to upda

    I'm trying to update iTunes software, but when I go to Help/Check for updates, I continue to get the message: "The iTunes update server could not be contacted. Please check your Internet connection or try again later."  Is there another way to update?

    Try updating using an iTunesSetup.exe (or iTunes64Setup.exe) installer file downloaded from the Apple website:
    http://www.apple.com/itunes/download/

  • BADI-User exit required for updating Purchase order header field -IHREZ

    Hello All,
    We have requirement in our business to update the purchase order header field "our reference" EKKO-IHREZ with some text field. We need a BADI/user exit that can be used for updating this field . We have checked the BADI ME_PROCESS_PO_CUST and unfortunately we are not able to use this BADI as it getting triggered in enjoy SAP transactions ME21N , ME22N etc. We are not creating the purchase order manually and we are using ME59N for creating Purchase order . Hence we are looking for some user exit/BADI that can be used in ME59N for updating the purchase order header field IHREZ.
    Thanks in advance for your immediate response .
    With regards,
    Joseph Anand B

    TRY using the exist u2022     EXIT_SAPLME59_001
    You can also later on add this field by BAPI_PO_CHANGE

  • HT4972 cant update an iphone 4 to latest ios connected to computer and through itunes- wont ever connect  to server - note i cant get itunes to update to latest version either just doing help/check for updates  - it says itunes update server cant be conta

    trying to get a user with an iphone 4 to update to latest IOS - he is on 4.2.1 - off and on for months he has tried and it always fails trying to connect to server etc.
    note - he cant even update itunes version without his phone hooked to his computer. just clicking help and check for updates in itunes it will say itunes update server cant be connected.... so until we get that itunes fixed he wont be able to update his ios it appears. ideas?

    Disalbe ALL security software (firewall, antivirus, etc.) running on your computer while updating.

  • Reporting accuracy, and OS requirements for updates?

    Maybe I am not doing "Software Updates" or "Device Collections" right, but I have a collection of computers I'm deploying Software Updates to. 
    The Software Update package currently only consist of Windows 7 updates. 
    The collection I'm deploying to, however, has a few Windows 8 computers in it.
    Because of this, the Windows 8 computers skew the "Compliance" reports for this software update package, indicating the computers are in a "Compliance unknown state". 
    Is there a way I can configure Software Requirements for Software Updates (like Win 7 x64 only);
    or what's the solution here for accurate reports?
    make a different collection for Windows 8 computers? Add Windows 8 updates to the package? 

    If the Windows 8 PC are listed as unknown then there is a GPO or local policy blocking them from scanning for SU. This will have nothing to do with how your collection are setup.
    On one of Windows 8 PCs that is affected, review all the GPOs and determine which GPO is overriding CM12.
    http://www.enhansoft.com/

  • Help required for unicode compatibilty

    Dear All,
    We are in a process of analyzing the impact of unicode compatibility for our environment.
    Following is our scenario:
    - ECC6.0 is non unicode systsem
    - Need to buid unicode CRM 7, SCM 7, PI 7.1 and BI7
    - Need to integrate the above systems to non unicode ECC system.
    Our questions are :
    1. Is there any performance consideration when using communication between an Unicode and non-Unicode system?
       Is Unicode - Unicode faster than Unicode - non-Unicode communication performance wise?
    2. Do we face any  technical or functinal problems while trying to integrate
       unicode BI/ NW Java Stack  to non unicode systems.
    3. Do we need to review our sizing estimations due to unicode implemenation?
    5. what will be the storage consumption increase for unicode systems compared to non unicode?
    It would be greatly helpful for me if you can clarify these doubts.
    Thanks and Regards

    Hi,
    1. I think no one has really measured this. I expect a slightly higher requirement for Unicode <--> Non-Unicode interfaces.
    2. Please have a look at SAP Notes 838402, 73606, 975768 and 1358929 for restrictions in Non-Unicode systems. SAP highly recommends to go for Unicode in the whole landscape.
    3. and 5.  If you use the SAP quicksizer (http://service.sap.com/quicksizing), then Unicode is integrated.
    " Please note that the Quick Sizer results include Unicode requirements. For more
    information on additional requirements caused by Unicode, see
    http://service.sap.com/unicode -> Unicode Media Library -> Unicode information on
    specific topics: SAP Business Suite Unicode Hardware Requirements"
    Best regards,
    Nils Buerckel
    SAP AG

  • Help asked for a sql request - thanks

    Hello,
    I'm not a sql Guru... Who can help for this sql request ?
    First I have this:
    SELECT ADDINFO_ID, INFO, LANGUAGE_FK, ENGLISH_NAME
    FROM V_ADDINFOS
    WHERE LANGUAGE_FK = 'EN' (which is very simple...-)
    But now complicated... I have to add this in the same request:
    select sum(val) as nbrInfo
    from(
    select count(*) val from eccgis where addinfo1_fk = ADDINFO_ID
    union all
    select count(*) val from eccgis where addinfo2_fk = ADDINFO_ID
    union all
    select count(*) val from eccgis where addinfo3_fk = ADDINFO_ID
    union all
    select count(*) val from thirdgis where addinfo1_fk = ADDINFO_ID
    union all
    select count(*) val from thirdgis where addinfo2_fk = ADDINFO_ID
    In other words, for each row of the first select, I need to know how much it is linked in the tables eccgis and thirdgis...
    Hope is is clear... -)
    Thank you very very much,
    Michel

    Hi, Michel,
    Almost anywhere that SQL allows an expression (such as a column name, literal or function call) it also allows a scalar sub-query, a SELECT statement based on any table (or tables) that returns one column and (at most) one row. Like other sub-queries, scalar sub-queries can be corellated to the main query.
    To get the grand total you want on each row of your output:
    SELECT ADDINFO_ID, INFO, LANGUAGE_FK, ENGLISH_NAME
    , (select count(*) from eccgis where addinfo1_fk = ADDINFO_ID)
    + (select count(*) from eccgis where addinfo2_fk = ADDINFO_ID)
    + (select count(*) from eccgis where addinfo3_fk = ADDINFO_ID)
    + (select count(*) from thirdgis where addinfo1_fk = ADDINFO_ID)
    + (select count(*) from thirdgis where addinfo2_fk = ADDINFO_ID)
    AS nrbInfo
    FROM V_ADDINFOS
    WHERE LANGUAGE_FK = 'EN';VERY IMPORTANT: Each sub-query must be in parentheses. You'll get a run-time error if any scalar sub-query returns more than one row. (Returning no rows is okay: the value will be NULL).
    By the way, this looks like a bad table design. If each row in eccgis or thirdgis can be associated with more than one foreign key, they should be kept in a separate table. That's the standard way to handle many-to-many relationships.

  • May I know how to update preinstalled iPhoto in MacBook Pro?I was not given the password which was required for updating.

    I need to update my preinstalled iPhoto in my MacBook Pro, how ever i was not issued with the password needed for updating.

    AppStore software and the free iLife included on new Mac's is copy protected and can only be updated or reinstalled (free) by the original owner.
    If you bought the machine used or a "open box", the original owner should have wiped the Macintosh HD partition and just reinstalled OS X, but many don't do that or what occurs is the store reinstalls OS X free and then free iLife using their AppleID.
    So when it comes time to update it, you can't because you have a different AppleID and password.
    It's terrible hassle with all this mega-copy protection shenanigans because it allows someone to sell you a used Mac with tons of software for more money you later can't update for security issues and compatibly with newer OS X versions.
    So you can either to choose to use it as is, or wipe and reinstall OS X and then buy a copy of the software, then it will be in your name.

  • Help Required for Denormalization

    Hi Guys ,
    Need help in denormalising table:
    SQL > DESC SAMPLE
    Name Null? Type
    CNO VARCHAR2(10)
    CTYPE VARCHAR2(1)
    CED DATE
    EED DATE
    STATUS VARCHAR2(2)
    REASON VARCHAR2(3)
    CFROM DATE
    CTO DATE
    My data looks like this
    CNO C CED EED ST REA CFROM CTO
    123456a A 03-JUN-05 31-DEC-99 01 023 02-JUN-05 07-MAY-08
    123456a B 03-JUN-05 31-DEC-99 02 012 17-MAY-06 27-OCT-82
    123456a C 01-JAN-07 31-DEC-99 03 001 12-JUL-08 23-NOV-08
    I want to denormalise that data into as per the following record
    SQL> DESC NEW_SAMPLE
    Name Null? Type
    CNO VARCHAR2(10)
    ACED DATE
    AEED DATE
    ASTATUS VARCHAR2(2)
    AREASON VARCHAR2(3)
    ACFROM DATE
    ACTO DATE
    BCED DATE
    BEED DATE
    BSTATUS VARCHAR2(2)
    BREASON VARCHAR2(3)
    BCFROM DATE
    BCTO DATE
    CCED DATE
    CEED DATE
    CSTATUS VARCHAR2(2)
    CREASON VARCHAR2(3)
    CCFROM DATE
    CCTO DATE
    SAMPLE RECORD LOOKS LIKE THIS :
    CNO ACED AEED AST AREA ACFROM ACTO
    ----- ----- ----------- ------------- ------------BCED BEED BST BREA BCFROM BCTO
    -------- --------- --------- --------- ------ ------CCED CEED CST CREA CCFROM CCTO
    123456a 03-JUN-05 31-DEC-99 01 023 02-JUN-05 07-MAY-08
    03-JUN-05 31-DEC-99 02 012 17-MAY-06 27-OCT-82
    01-JAN-07 31-DEC-99 03 001 12-JUL-08 23-NOV-08
    I mean i want all the columns in a single table , so some one please guide me how should i start inserting the data into new table . Please help me with Sql i should be writing to insert the data from the existing table.
    Thanks in Advance.
    Regards,
    Venu Kadiyala
    Message was edited by:
    Kadiyala,Venu

    1.
    CTAS new_sample with columns: CNO, A*, B,*, C*
    select only A* columns where CTYPE='A'
    2.
    insert into new_sample with columns with B*
    with subquery from old_sample values (B*)
    where old.CNO = new.CNO and old.CTYPE='B'
    3.
    insert into new_sample with columns with C*
    with subquery from old_sample values (C*)
    where old.CNO = new.CNO and old.CTYPE='C'

  • PCUI 4.0, Search Help Required for New field

    Hi everyone
    I am working in CRM 4.0 Sales Order application
    We created a new field in CRM sales Order in Header level in SAP GUI through EEWB.
    The search help for the new field is working fine in SAP GUI. We want to add the same field with F4 help functionaliity in PCUI as well.
    The field has been added in structure CRMT_BSP_SLS_OD1_General. It also shows domain value for the field however Origin of input field ie empty
    The field has been added in PCUI and is successfully showing data inputted in SAPGUI
    However we need search help functionality for the field
    i tried these two steps
    1) i checked on domain value checkbox and changed the field from input to dropdown. However the dropdown is empty in PCUI. Whenever i check box domain values for some field then all the possible values in SPA GUI are displayed in PCUI, however this is not working here.
    2) I put Value_table in F4 of the field
    This is also throwing up empty values
    Am i missing something in this case
    Please let me know how to go about it
    TIA
    Asad

    Hi Frederic
    Thanks for your response
    I am not sure what is meant by regenerating the field group in this case
    I added the entries for my view in the field group and generated the layout of the field group (If this is what you mean)
    The field is working fine. I am able to save values to the field and able to see values saved in GUI.
    I haven't linked search help of the field in PCUI
    I am not sure how to go about it.
    I used the data element in the structure for the field.
    The data element has Domain entry in <b>Entry Help/Check</b> of the structure
    If i check the Domain Value checkbox in my field group then the domain values should be available in dropdown if the field is dropdown
    However i am not able to see the possible values of the field (It is present in SAP GUI)
    Does something else needs to be done in this case
    TIA
    Asad

  • Seeburger help required for 810 and Dispatch Advice (IDOC type DESADV).

    Hi All,
    1. Please let me know blogs which clearly shows settings for Seeburger components for 850 (Purchase Order) to IDOC Scenario
    --- Seeburger Workbench
    --- Seeburger Mapping Designer (BIC)
    --- Seeburger Counter and Varaibles
    --- Seeburger AS2 Spoke
    --- Any other Seeburger Component setting required
    I have understand blog for 850 -- /people/rajeshkumar.pasupula/blog/2009/08/05/wanna-implement-seeburger-for-edi-find-the-booster
    2. Anybody has blog for 810 or Dispatch Advice (IDOC type DESADV).
    3. Can anybody provide me Mapping Logic (at field level) done in XI/PI for 850, 810 , Dispatch Advice (IDOC type DESADV) .
    Regards

    Hi Rickkk,
    1. Please let me know blogs which clearly shows settings for Seeburger components for 850 (Purchase Order) to IDOC Scenario
    --- Seeburger Workbench
    --- Seeburger Mapping Designer (BIC)
    --- Seeburger Counter and Varaibles
    --- Seeburger AS2 Spoke
    --- Any other Seeburger Component setting required
    For SEEBURGER workbench please go through this blog and navigate the enbebbed links furthur to know about Seeburger workbench too.
    /people/prateek.srivastava3/blog/2009/08/01/seeburger--part-1--the-basics
    2
    2. Anybody has blog for 810 or Dispatch Advice (IDOC type DESADV).
    For 810 i think the procedure would be the same but themseeburger mapping program that validates the ANSX 810 would be different.As far as 997is concerned 997 is a functional acknowledgement.Its a genric format that is used to send acknowledgement for any EDI transaction set that has been sent.
    3. Can anybody provide me Mapping Logic (at field level) done in XI/PI for 850, 810 , Dispatch Advice (IDOC type DESADV) .
      The logic will be based on the trading partner guidelines which will contain the description of all the semantic and syntactiic description about the segments ,its feilds.we need to consider the guidelines and target side specifications too while mapping.
    Thanks,
    Ram.

  • Access/Privilege required for UPDATE/RELEASE actions

    Hi,
    I am a new user of BPEL 101.3.1. I have configured the identity service to CUSTOM and have given the following roles to the user created
    Roles :-
    1. BPMSystemAdmin
    2. BPMWorkflowAdmin
    3. BPMDefaultDomainAdmin
    4. BPMWorkflowReassign
    5. BPMWorkflowSuspend
    6. BPMWorkflowViewHistory
    The Acquiring/Reassignment of the task is happening successfully but then as an when i am trying to Update the Task or Release the Task then i am getting the following error.
    <2007-12-19 22:08:32,639> <ERROR> <oracle.bpel.services.workflow> <::> Invalid action on workflow task.
    Action RELEASE on task 2f9034534324d8b2:491a42ee:116f2f6cca6:-7b30 is not valid because of User does not have access/privilege to perform the action. .
    Contact oracle support if error is not fixable.
    ORABPEL-30036
    Invalid action on workflow task.
    Action RELEASE on task 2f9034534324d8b2:491a42ee:116f2f6cca6:-7b30 is not valid because of User does not have access/privilege to perform the action. .
    Contact oracle support if error is not fixable.
         at oracle.bpel.services.workflow.task.impl.TaskService.performPreActionValidation(TaskService.java:3408)
         at oracle.bpel.services.workflow.task.impl.TaskService.performPreActionValidation(TaskService.java:3440)
         at oracle.bpel.services.workflow.task.impl.TaskService.releaseTask(TaskService.java:1849)
         at oracle.bpel.services.workflow.task.impl.TaskService.releaseTask(TaskService.java:1840)
         at oracle.bpel.services.workflow.task.ejb.TaskServiceBean.releaseTask(TaskServiceBean.java:794)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:31)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAs(Subject.java:396)
         at com.evermind.server.ThreadState.runAs(ThreadState.java:622)
         at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:34)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.TxRequiresNewInterceptor.invoke(TxRequiresNewInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
         at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
         at TaskServiceBean_RemoteProxy_68d4144.releaseTask(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    I am getting the same error for Updating as well as Releasing the Task.
    Can any 1 tell me that whether i am missing on some role???
    Thanks
    Prashant N.

    Same problem here...
    Did you find a solution?

  • Help required for doing LIKE search in SQL

    Hello All,
    I have situation like below 
    DECLARE @TempTable TABLE (Name1 VarCHar(100), Name2 VarChar(100))
    INSERT INTO @TempTable(Name1, Name2)
    VALUES('_HASKAR','BHASK_R')
    SELECT * 
    FROM @TempTable 
    WHERE Name1 LIKE Name2
    Both the columns are having WildCard (underscores). How can I do like search so that the where condition will be TRUE?
    Regards,
    Amar Ankatha
    amar ankatha

    Hi,
    If I understand correctly, the position of H, A, S, K, R is fixed in the strings and you can use
    SUBSTRING function.
    DECLARE @TempTable TABLE (Name1 VarCHar(100), Name2 VarChar(100))
    INSERT INTO @TempTable(Name1, Name2)
    VALUES('_HASKAR','BHASK_R')
    SELECT *
    FROM @TempTable
    WHERE substring(Name1,2,4) = substring (name2,2,4) and right(Name1, 1) = right(Name2, 1)
    Thanks.
    Tracy Cai
    TechNet Community Support

Maybe you are looking for

  • Problem with WLST in weblogic application server 10.3 on solaris 10 x86

    Hi Friends, I installed Sun Solaris 10 on my desktop x86. I am able to install oracle weblogic application server 10.3. I created one domain and I am trying to start AdminServer on that using WLST command. Before that , I started the admin server fro

  • Help needed to connect Canon 6D to iPad remote app

    I have the iPad EOS remote app and a Canon 6D I cannot get them to communicate, on the 6D wi-fi set up screen the manual tells you to select wi-fi function then shows a screen with different graphics on it so you can select mobile phone etc, well I c

  • Display Announcements List from one Site Colleciton in another

    Hi there, I have an announcments list in one site collection - say http://intranet/sites/hr that I would like displayed as a webpart on the home page of another site collection - say http://intranet (the root site). I've found some great articles on 

  • ERROR:ORA-00257

    HI all, My /home directory has has got no space,so ia m getting the error,i know that i have to delete the ARCHIVE log files,....I am unable to log in,when i try i am getting an error of ORA-00257,can anyone of you tell me where i can find archive fi

  • How do Streams work?  I mean specifically, how Java handles it

    I mean this...this is my code class Wilson implements ConstantsBase      public static void main(String[] args) throws IOException           Maze mazeArray = new Maze();           int count = 0;           int character = System.in.read();           w