Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...If I'd only had resource like eng-tips when I was just getting started! I might have dazzled them with my brilliance instead of my BS..."

Geography

Where in the world do Tek-Tips members come from?
eshie003 (Programmer)
7 May 12 16:52
Hi,  In the query below, I want to insert the results of the query into my SQL SVR, table [#TEST].  The linked server (URAFP4 is Oracle).  When I run the query below, I am getting an error on the last line of the query"  Incorrect syntax near ')'.  What am I missing?


SELECT * INTO [RDM].[dbo].[#TEST] FROM
(SELECT * FROM OPENQUERY(URAFP4,'SELECT DISTINCT  cmc.clcl_id,
       cmc2.cdml_seq_no,cmc.clcl_cur_sts,cmc.clcl_recd_dt,
       cmc.clcl_paid_dt, cmc2.ipcd_id , cmc2.rcrc_id,
       cmc2.cdml_from_dt,cmc2.cdml_chg_amt,cmc2.cdml_paid_amt,
       cmc2.cdml_allow,cmc.prpr_id,cmc1.prpr_name,
       cmc1.mctn_id ,cmc2.cdml_sepy_acct_cat,
       cmc3.excd_id,
       cmc3.excd_short_text
FROM faubh.cmc_clcl_claim cmc INNER JOIN faubh.cmc_prpr_prov cmc1
     ON cmc1.prpr_id = cmc.prpr_id
     LEFT JOIN faubh.cmc_cdml_cl_line cmc2
     ON cmc2.clcl_id = cmc.clcl_id
     LEFT JOIN faubh.cmc_excd_expl_cd cmc3
     ON cmc3.excd_id = cmc2.cdml_disall_excd
WHERE cmc.grgr_ck = 6693
      AND trunc(cmc2.cdml_from_dt) >= 2011-07-01
      AND TRUNC(cmc2.cdml_from_dt) <= 2011-08-01
      AND cmc2.cdml_cur_sts = 02
      AND cmc2.cdml_paid_amt <>0
      AND cmc1.mctn_id=850390576'))
    
PWise (Programmer)
7 May 12 16:58
perhaps missing quote
AND cmc1.mctn_id='850390576'))
 
eshie003 (Programmer)
7 May 12 17:01
I tried that previously and when I modify last line to:
AND cmc1.mctn_id='850390576'))

I get 2 errors:

Msg 102, Level 15, State 1, Line 21
Incorrect syntax near '850390576'.
Msg 105, Level 15, State 1, Line 21
Unclosed quotation mark after the character string '))
drlex (TechnicalUser)
8 May 12 7:45
I think that you just need a table reference after the query.

CODE

SELECT * INTO [RDM].[dbo].[#TEST] FROM
(SELECT * FROM OPENQUERY(URAFP4,'SELECT DISTINCT  cmc.clcl_id,
 [...]      AND cmc1.mctn_id=850390576')) T1

soi là, soi carré

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close