Unable to execute update query. Can't we use a query within a update query which also has joins?

Below is the query:
UPDATE 
(select * from [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals as CFRQ
LEFT JOIN [HR_DEV_DM].[CFQ_TEST].t_Chg_Rsns as CHGRSNS
ON CFRQ.RecChangeID = CHGRSNS.Chg_ReasID)
INNER JOIN [HR_DEV_DM].[CFQ_TEST].t_Qt_Typs
ON [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.QuoteType = [HR_DEV_DM].[CFQ_TEST].t_Qt_Typs.Qt_Typ 
SET [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecKey = dbo.BuildRecordKey([HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[ReferralCode], [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[RetentionID],
[HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[ClientFName],[HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[ClientLName], 
IIf([HR_DEV_DM].[CFQ_TEST].t_Qt_Typs.Qt_Grp='MOAT',[HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[QuotePolicyType],[HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[ClientZip]),
[HR_DEV_DM].[CFQ_TEST].[CFQ_Referrals].[QuoteType])
WHERE ((([HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecProcessed)=0) 
AND (([HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecChange)=Yes) 
AND (([HR_DEV_DM].[CFQ_TEST].t_Chg_Rsns.ImpactsRecKey)=Yes)) 
OR ((([HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecKey) Is Null)) OR ((([HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecKey)=''));
When I run this query, below are the errors I see:
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '('.
Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'INNER'.
Msg 102, Level 15, State 1, Line 14
Incorrect syntax near 'HR_DEV_DM'.
Msg 102, Level 15, State 1, Line 17
Incorrect syntax near 'HR_DEV_DM'.
Msg 102, Level 15, State 1, Line 17
Incorrect syntax near 'HR_DEV_DM'.
I don't see any problem with 'HR_DEV_DM'. Because,  I was able to run the below queries:
select * from [HR_DEV_DM].[CFQ_TEST].t_Chg_Rsns
select * from [HR_DEV_DM].[CFQ_TEST].t_Qt_Typs where Qt_Typ = 'Auto/Cycle'
select * from [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals where QuoteType = 'MOAT'
Please help.......

What you are trying to achieve is possible, it's just a matter of syntax.
UPDATE [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals
SET [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecKey = dbo.BuildRecordKey([HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[ReferralCode], [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[RetentionID],
[HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[ClientFName],[HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[ClientLName],
IIf([HR_DEV_DM].[CFQ_TEST].t_Qt_Typs.Qt_Grp='MOAT',[HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[QuotePolicyType],[HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.[ClientZip]),
[HR_DEV_DM].[CFQ_TEST].[CFQ_Referrals].[QuoteType])
FROM
select * from [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals as CFRQ
LEFT JOIN [HR_DEV_DM].[CFQ_TEST].t_Chg_Rsns as CHGRSNS
ON CFRQ.RecChangeID = CHGRSNS.Chg_ReasID
INNER JOIN [HR_DEV_DM].[CFQ_TEST].t_Qt_Typs
ON [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.QuoteType = [HR_DEV_DM].[CFQ_TEST].t_Qt_Typs.Qt_Typ
WHERE ((([HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecProcessed)=0)
AND (([HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecChange)=Yes)
AND (([HR_DEV_DM].[CFQ_TEST].t_Chg_Rsns.ImpactsRecKey)=Yes))
OR ((([HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecKey) Is Null)) OR ((([HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecKey)=''))) A
WHERE [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals.RecChangeID = A.RecChangeID

Similar Messages

  • Since I downlaoded the latest update, I can no longer use Yahoo Messenger within firefox

    I was prompted to download the latest security update today, which I did. Since rebooting, although my yahoo messenger contacts appear on the web page, I am unable to open a dialog box to send IM's

    Its known issue, see;
    * https://bugzilla.mozilla.org/show_bug.cgi?id=713014
    maybe fixed in nightly?
    * firefox.com/beta

  • Unable to open https sites. can open when using firefox in safe mode.

    Mozilla Firefox has been an exceptional browser, however in the last update I have experienced problems when trying to open https sites. They will not open and then time out. I do not have this problem when using Internet explorer. I have contacted customer service at the problem sites, and they have said other customers have also experienced this problem. I have gone into options and have changed various settings to see if this would solve the problem. It didn't, your response would be appreciated.. Please note if I use firefox in safe mode I can access these sites? My E-mail as follows: [email protected]

    Did you perhaps install an extension to open sites with https
    # Type '''about:config''' into the location bar and press "Enter"
    # Use Find ("Ctrl+F") to look for '''https'''
    One such extension is "HTTPS-Everywhere"
    As you probably know Firefox Safe Mode disables extensions and some preferences.
    http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Extension_issues
    You posted a question here: you should check for all of your answers at...
    :Unable to open https sites. can open when using firefox in safe mode. | Firefox Support Forum | Firefox Help
    :https://support.mozilla.com/en-US/questions/872957
    You are expected to pick up your answers where you post them, in the upper right corner is a "get email updates" that you can click on. For more information, see my avatar icon to the left of my reply where you posted.

  • HT3819 Since the last AppleTV update I can no longer use home sharing. chI have checked all IDs, rebooted iTunes, AppleTV, and my router, eck port settings in my firewall. Nothing works. Is it me or did this update screw things up?

    Since the last AppleTV update I can no longer use home sharing. I have checked all IDs, re-booted iTunes, my router, and AppleTV, and checked the port settings in my firewall. nothing works. Is it me or did this last update really scew things up?

    Hi,
    I tried everythink, but same as before!
    - droppings ot the main screen
    - loosing Home Share
    now even on iPads !
    Frustrating!
    I'm now more than convinced that this is caused by the latest iTunes version.
    As some others stated in other threads .... it seems that Apple doesn't really take care of this problem. So what if, if we could make them feeling the same pain as we do. ... Just by dropping them a mail as soon as we have the problem again. Not more often, we don't want to be unfair, but everytime it happens.
    I found this feedback site http://www.apple.com/feedback/itunesapp.html
    I will start now with this.... maybe this will help to rise a little bit of attention
    Tweety
    This is the mailbody I always use
    Hello all,
    Since the last update to iTunes Version 10.6.1 (7) streaming content (Movies and TV shows) to Apple TVs and iPads has two major problems:
    - Home Sharing is lost during streaming (streaming stops even if a large portion of the content is already preloaded)
    - streaming stops and the main screen pops up (Home Sharing still available)
    This happens sometime after some minutes, sometimes after several hours, but it surely happens.
    I followed every advice I could found on this support website. There are now a lot of threads following this issue.
    Sometimes it seems getting better, but hours later the same isues occured again. Watching content on this enviroment is a real pain and very frustrating.
    As many others I'm now convinced that the latest update of iTunes caused this problem.
    Our family enviroment contains the following Apple products:
    - iTunes on a Win7 32 bit Noname PC (all content)
    - second iTunes on a iMac with OS 10.6.8 (all content)
    - third iTunes on a MacBook Pro with OS 10.6.8 (daughter, only selected content)
    - fourth iTunes on a Win7 32 Samsung Notebook (son, only selected content)
    - all iTunes sharing the same Home Sharing ID
    - 2 Apple TV second generation
    - 1 Apple TV first generation
    - 2 iPod touch (bought last year)
    - 2 iPads (second generation)
    all firmware or software are on latest available patchlevel.
    At this moment, I can not recomend to others to buy this products.
    I will drop this feedback everytime my famiily and I facing this problem... just to help you to get a better feeling of the urgency of this issue.
    Thanks for every effort in advanced.

  • After the IOS7 update, i can no longer use my imessage and facetime. It says "waiting for activation" and tried to log in on my apple id but it turned out to connection error. Please help me guys! Thank you.

    After the IOS7 update, i can no longer use my imessage and facetime. It says "waiting for activation" and tried to log in on my apple id but it turned out to connection error. Please help me guys! Thank you.

    Have you tried to reboot your phone(hold home and lock button simutainiously)?

  • Today when i was downloading new songs a message popped up stating that my ipod can not be used because i have to update the software to 10.6.3. I cant find anywhere on the this website where i can update my ipod touch to that version

    Today when trying to download new songs to my Ipod touch a message popped up stating that my Ipod can not be used because I need to update the software to 10.6.3 and to go www.itunes.com. I cant find where to update my Ipod touch to the version on the website. HELP!!!

    I suspect you have a Mac with OSX 10.5.8. If so see:
    ios 6 and macosx 10.5 on a pre intel...: Apple Support Communities
    Otherwise what OS and version do yo have?
    What version of iTunes do you have?

  • In the new iOS 7.0.2 update, I can no longer find the iTunes Radio in the music application. Has it been removed, or is there still a way to access it?

    In the new iOS 7.0.2 update, I can no longer find the iTunes Radio in the music application. Has it been removed, or is there still a way to access it?

    Hi jdog44,
    Thanks for using Apple Support Communities.  iTunes Radio should be accessible from the bottom of the Music app screen as shown in this article:
    About iTunes Radio
    http://support.apple.com/kb/HT5848
    You could try completely closing the Music app:
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    A restart may also help:
    iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/HT1430
    Cheers,
    - Ari

  • After update, I can not longer use iCloud on my PC (using Windows Explorer)

    After update, I can no longer use iCloud on my PC (using Explorer)

    Uninstall and reinstall iCloud - it will work then

  • I have been having problems since i installed the quicktime update yesterday. can i revert to the version before the update?

    I have been having problems since i installed the quicktime update yesterday. can i revert to the version before the update? how would i do that?

    Hi, I don't think I've done that for a few years, but what exact version was it you installed?
    Is this an Intel iMac, or a PPC iMac?
    At the Apple Icon at top left>About this Mac.
    Then click on More Info>Hardware and report this upto but not including the Serial#...
    Hardware Overview:
    Model Name: iMac
    Model Identifier: iMac7,1
    Processor Name: Intel Core 2 Duo
    Processor Speed: 2.4 GHz
    Number Of Processors: 1
    Total Number Of Cores: 2
    L2 Cache: 4 MB
    Memory: 6 GB
    Bus Speed: 800 MHz
    Boot ROM Version: IM71.007A.B03
    SMC Version (system): 1.21f4
    Pehaps more important, what exact problems are you having Kim?

  • Since the recent update I can no longer use my camera connection kit on any of my iPad's. Any ideas to remedy this?

    Since updating my iPad  devices  (iPad 1,2 and iPad) with the latest iOS, I can no longer use the camera connection kit to load photos directly into my camera roll. Anybody have any ideas on remedying this problem?

    Open Disk Utility, select the External Hard Drives first icon in the list of Drives, click the Repair Disk button.
    Dennis

  • Additional fields in infoset query can not be used as datasource fields

    I create one infoset query with additional fields (using ABAP code) in R/3. When I create datasource RSO2 using this infoset query, system only show all fields without additional fields that I enhanced in infoset query. Does that mean we can not get additional fields information in generic datasource creation that we enhanced in infoset query?

    dear Awa,
       you are enhanced some fields in r/3.right that fields are  shown in
    rsa6 select your data source click on display your datasource then select
    extract structure its shows how many fields are haveing particular
    datasource .or otherwise goto rso2 select your data source display
    double click on  your extractstructure  its show how many fields haveing
    the particular datasource. check the Rsa6 what ever fields you newly added that field default hide mode
    you remove the hide tickmark.

  • How can I access the same table within AFTER UPDATE trigger?  mutating

    I'm trying to have processing done within a before or after update trigger.
    reduced what I want to do down to a select within the trigger.
    create or replace TRIGGER "AU_TABLE_A"
    after update on "TABLE_A"
    for each row
    declare
    l_res_status NUMBER:=0;
    l_count NUMBER:=0;
    begin
    SELECT COUNT(*) INTO l_count
    FROM TABLE_A
    WHERE ID = :NEW.ID AND STATUS_ID = 9;
    end;
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1,
         ORA-04091: table TABLE_A is mutating, trigger/function may not see it
         ORA-06512: at "BHRS.BU_MR_RES_APPR", line 13
         ORA-04088: error during execution of trigger 'BHRS.BU_MR_RES_APPR',
         update TABLE_A set "ID" = :b1, "STATUS_ID" = :b2, "COMMENTS" = :b3
         where "ID" = :p_pk_col
    IS THERE A WAY AROUND IT?
    Thank you, Bill

    The very common approach to workaround mutating table problem is passing the table state through the package variables. I.e. - you create a package with one global variable ( say l_count). Then you need
    1) a trigger before update for statement - here you counts your rows and set the package variable accordingly.
    2) a trigger after update for each row - here you read the rowcount from a package variable and do your actual work
    3) a trigger after update for statement - here you reset your package variable.
    This approach uses the fact, that mutating table problem occurs only with triggers for each row and the order of execution of different trigger types.
    However, counting records in every update statement (whereas not so worse although as doing this for each row within an update) may consume a lot of resources, so, possibly , you can rethink your business needs/approach.
    Best regards
    Maxim

  • Why can't I use several apps anymore since update to iOS8?

    It really harasses me not being able to use several apps on my iPad anymore since I updated to iOS8. I paid for some of them not to long ago!!! Why doesn't Apple warn people that some apps will not work anymore when you update? I have already contacted the developers but they told me, that Apple has changed such a lot, that it would take them too much time to make their apps compatible.

    Apple should offer the ability to downgrade the device back to the previous version of iOS for people in your situation.
    I learned the hard way, long ago: don't upgrade unless you HAVE TO. It's almost always best to never update more than one major version past the one your Mac or i-device came with. It will become slow and laggy, as the newer systems are made to run best on newer hardware. Plus you get to deal with apps breaking, since Apple has a very small commitment, if any, to backwards compatibility.
    I've had Apple render all my software obsolete and non-functional twice and major portions of it one more time, during the 68000-PPC-Intel-32bit-64bit transitions. I always knew it would happen with iOS eventually, as well.
    Sadly many great developers and their great apps were killed off by these transitions since they were smaller devs who could not justify redoing a niche product that didn't pay their bills well enough. It's part of life, like when a great restaurant goes away. Nothing lasts forever.
    My advice is that you buy a used device with the iOS version you prefer. I still have iOS 6 on my iPad because it does everything I want, and who knows if these apps will still work on newer versions, or if the iPad will become unusably laggy. Besides, I greatly prefer the look-and-feel of iOS 6 with its gray UI and easy-on-the-eyes, subdued tonality. I cannot stand the stark, bland, oppressive whiteness of iOS 7–8. To each their own.
    RIP Steve

  • Since performing the latest update I can no longer use more than three displays.

    Does anyone know of a fix for the problem where you can only run 3 monitors?  I was running 4 displays before the update but now only three can run.  Apple support recognizes the problem but does not have a answer.  Anybody else haveing this problem?

    Yes, see:
    https://discussions.apple.com/thread/6224241?tstart=0
    10.9.3 kills third monitor: Apple Support Communities

  • How can I avoid using rollback segment for batch updates.

    I am currently trying to avoid associating a large amount of space for rollback segment as this gets filled up only during the nightly batch updates. All that space will never be used during the day. Hence want to know if there is any way of avoiding the use of rollback segment at the session level.
    Rajesh

    No, but what you can do is create a large rollback segment to use with your batch job, at the start of your batch job bring the segment online, then use set transaction to use that rollback segment, when the batch job is finished and committed, you can then bring the rollback segment offline.
    If you are really pressed for space, as an alternate plan, you could actually create the large segment before the batch job and drop it after.

Maybe you are looking for