sql statement with error #933

  • Thread starter perryclisbee via AccessMonster.com
  • Start date
P

perryclisbee via AccessMonster.com

My ODBC sql code below is giving me the error: #933: SQL command not
properly ended. Can anyone tell if I'm missing a comma or something that is
holding this query up?
thanks, Perry




select
pd."cd" BAR_Plan_Code
,trim(pd."nam") BAR_Plan_Name
,pd."desc" BAR_Plan_Desc
,pd."chg_cd" BAR_Charge_Code
,to_number(ic.DVA_CONTRACT_NO) Xwalk_Contract_Number
,ic.DVA_ROPS_FINANCIAL_CLASS Xwalk_Financial_Class
,ic.DVA_PLAN_GROUP_CODE Xwalk_Plan_Group
,vpf. plan_group Plan_Group_Estimate_Focus
,substr(ic.DVA_PLAN_GROUP_CODE,1,4) Xwalk_Plan_Group_Prefix
,nvl(substr(ic.DVA_PLAN_GROUP_CODE,6,2),'NONE') Xwalk_Plan_Group_Suffix
--,ic.EFFECTIVE_DATE Xwalk_Effective_Date
--,ic.COMMENTS Xwalk_Comments
--,pd."renew_comment" BAR_Renew_Comments
--,pd."bill_form" BAR_Billing_Form
,trim(pd."bill_addr1") BAR_Claims_Address1
,trim(pd."bill_addr2") BAR_Claims_Address2
,replace(replace(replace(replace(replace(replace(replace(replace(replace(pd.
"bill_addr2",' ',''),'.',''),',',''),'#',''),'SUITE','STE'),'STREET','ST'),
'AVENUE','AVE'),'ROAD','RD'),'DRIVE','DR') BAR_Claims_Address2_Adj
,trim(pd."bill_city") BAR_Claims_City
,trim(pd."bill_st") BAR_Claims_State
,trim(pd."bill_zip") BAR_Claims_Zip
,substr(pd."bill_zip",1,5) BAR_Claims_Zip5
--,trim(pd."bill_contact") BAR_Contact
--,trim(pd."bill_phone") BAR_Phone
--,trim(pd."bill_ext") BAR_Extension
from bar.plan_demo pd left join rca.cw_insurance_contracts ic on pd."cd"=ic.
gam_plan_id left join managedcare.v_plan_f vpf on substr(pd."bill_zip",1,5)
=vpf.INSURANCE_ZIP5 and replace(replace(replace(replace(replace(replace
(replace(replace(replace(pd."bill_addr2",' ',''),'.',''),',',''),'#',''),
'SUITE','STE'),'STREET','ST'),'AVENUE','AVE'),'ROAD','RD'),'DRIVE','DR')
=replace(replace(replace(replace(replace(replace(replace(replace(replace(vpf.
INSURANCE_ADDRESS2,' ',''),'.',''),',',''),'#',''),'SUITE','STE'),'STREET',
'ST'),'AVENUE','AVE'),'ROAD','RD'),'DRIVE','DR')
where
pd."cd" in (10004,10028,10028,1004,10057,10058,10060,10065,10066,10081,10092,
10100,10126,10144,10158,10159,10166,10174,10182,10184,10195,10202,10202,10207,
10208,10210,10239,10242,10245,10248,10257,10259,10266,10267,10273,10273,10280,
10288,10291,10292,10293,10318,10336,10351,10354,10361,10368,10386,10387,10391,
10391,10397,10397,10401,10401,10402,10403,10425,10444,10448,10463,10467,10470,
10489,10492,10500,10517,10529,10544,10572,10573,10575,10598,10601,10626,10631,
10636,10636,10641,10641,10649,10701,10721,10724,10736,10737,10747,10757,10763,
10767,10787,10805,10807,10808,10808,10819,10827,10834,10836,10841,10843,10844,
10845,10855,10856,10858,10859,10860,10861,10873,10885,10892,10897,10912,10914,
10918,10919,10920,10921,10927,10944,10946,10947,10951,10954,10961,10982,10992,
10992,10993,10998,11004,11007,11008,11010,11012,11012,11018,11019,11022,11023,
11049,11062,11062,11083,11089,11090,11091,11103,11118,11121,11138,11149,11150,
11152,11153,11156,11169,11171,11171,11172,11178,11181,11182,11188,11205,11210,
11213,11222,11227,11234,11236,11240,11244,11247,11249,11260,11261,11270,11271,
11284,11292,11295,11299,11308,11317,11319,11325,11326,11328,11333,11334,11336,
11344,11347,11347,11356,11369,11383,11413,11423,11431,11447,11448,11452,11455,
11469,11475,11475,11482,1149,11493,11502,11506,11510,11512,11513,11516,11517,
11519,11544,11549,11550,11565,11567,11569,11572,11573,11578,1158,11580,11581,
11585,11587,11589,11591,11595,11597,116,116,11603,11614,11630,11631,11635,
11653,11655,11658,11659,11664,11665,11671,11684,11685,11690,11695,11696,11699,
11701,11712,11716,11716,11724,11727,11735,11745,11753,11754,11757,11762,11764,
11772,11774,11778,11780,11782,11783,11786,11787,11788,11790,11791,11792,11846,
11847,11848,11851,11853,11862,11868,11870,11875,11879,11884,11886,11889,11894,
11896,11901,11903,11916,11924,11930,11943,11947,11959,11960,11961,11973,11978,
11981,11995,12003,12004,12012,12015,12021,12042,12048,12050,12050,12055,12059,
12061,12064,12067,12069,12069,12071,12076,12076,12085,12088,12092,12093,12094,
12098,12105,12109,12116,12118,12122,12126,12130,12131,12138,12140,12144,12145,
12146,1215,1216,12163,12169,12170,12177,12198,12204,12216,12220,12222,12229,
12252,12257,12257,12258,12258,12259,12261,12261,12262,12263,12269,12277,12281,
12292,12295,12297,12304,12309,12310,12314,12315,12316,12317,12318,12319,12320,
12359,12360,12361,12363,12383,12383,12384,12386,12387,12395,12397,12399,12402,
12403,12413,12419,12423,12433,12439,12440,12448,12453,12458,12462,12472,12473,
12474,12475,12479,12480,12481,12482,12483,12490,12491,12493,12494,12495,12497,
12499,12516,12518,12522,12522,12528,12535,12536,12546,12547,12550,12554,12578,
12579,12580,12582,12583,12584,12586,12588,12589,1259,12594,12594,12595,12598,
12599,12600,12612,12614,12614,12619,12620,12621,12625,12626,12628,12632,12633,
12635,12636,12643,12645,12646,12651,12652,12653,12653,12655,12663,12676,12678,
12679,12686,12691,12691,12698,12718,12720,12727,12735,12735,12742,12744,12746,
12766,12769,12775,12781,12786,12793,12795,12797,12798,12799,12807,12809,12812,
12813,12815,12816,12818)
group by
pd."cd"
,trim(pd."nam")
,pd."desc"
,pd."chg_cd"
,to_number(ic.DVA_CONTRACT_NO)
,ic.DVA_ROPS_FINANCIAL_CLASS
,ic.DVA_PLAN_GROUP_CODE
,vpf.plan_group
,substr(ic.DVA_PLAN_GROUP_CODE,1,4)
,nvl(substr(ic.DVA_PLAN_GROUP_CODE,6,2),'NONE')
,trim(pd."bill_addr1")
,trim(pd."bill_addr2")
,replace(replace(replace(replace(replace(replace(replace(replace(replace(pd.
"bill_addr2",' ',''),'.',''),',',''),'#',''),'SUITE','STE'),'STREET','ST'),
'AVENUE','AVE'),'ROAD','RD'),'DRIVE','DR')
,trim(pd."bill_city")
,trim(pd."bill_st")
,trim(pd."bill_zip")
,substr(pd."bill_zip",1,5)
order by pd."cd"
INTO [Bar_Plan_Focus_Results]
 
G

Gary Walter

This looks like a make-table query to me?

I believe both Access and SQL Server
have some structure for make-table query

SELECT *
INTO sometable
FROM
WHERE
GROUP BY
ORDER BY

I don't know if that is it or not.
 
Top