X-Received: by 2002:ad4:4841:: with SMTP id t1mr5365455qvy.187.1591828256212; Wed, 10 Jun 2020 15:30:56 -0700 (PDT) X-Received: by 2002:a25:400e:: with SMTP id n14mr8358566yba.424.1591828255873; Wed, 10 Jun 2020 15:30:55 -0700 (PDT) Path: csiph.com!xmission!news.alt.net!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.databases.ms-sqlserver Date: Wed, 10 Jun 2020 15:30:55 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=156.39.0.199; posting-account=l2bzzwoAAABu-fdSSbYhIW6Ic9fVTF16 NNTP-Posting-Host: 156.39.0.199 References: <25356606-299b-4623-809d-0d6eb9af0906o@googlegroups.com> <4b1c3504-2511-4c3c-a5fb-b880e39caeb6o@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <07f4ed04-6ddf-42e8-afac-655b93b690e3o@googlegroups.com> Subject: Re: Unable to query xml data in sql server From: chris H Injection-Date: Wed, 10 Jun 2020 22:30:56 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Lines: 766 Xref: csiph.com comp.databases.ms-sqlserver:2045 On Wednesday, June 10, 2020 at 3:15:07 PM UTC-7, Erland Sommarskog wrote: > chris H (chris.sjpd@gmail.com) writes: > > That is a complete xml file. When I doubleclick to open it, it does no= t have root tag.=20 > >=20 >=20 > I would say it's not an XML file then. An XML file has exactly a single r= oot tag. SQL Server supports repeated root tags, but there are no root tags= at all here. >=20 > I get this error from sp_xml_preparedocument: >=20 > Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1 [Ba= tch Start Line 0] > The error description is 'Only one top level element is allowed in an XML= document.'. >=20 >=20 > DECLARE @x xml =3D=20 > ' 2020-200320523 > 1493 CRESTHAVEN LN,SAN JOSE, CA, 95118 > 1 > 1 > 1 > 02-01-2020 > 1547' >=20 > DECLARE @hDoc int > EXEC sp_xml_preparedocument @hDoc OUTPUT, @x >=20 >=20 > SELECT * > FROM OPENXML(@hDoc, '/', 1) > WITH=20 > ( > [AccidentReportNumber-AllPages] varchar(20), > AddressFullText varchar(100) '/trafficunit/driver', > "InjuredWas_driver" int '/involvedPeople', > [PedestrianActionA-AllPages] int, > [MotorVehicleInvolvedWithC-AllPages] int, > [CollisionOccurredDate-AllPages] date, > [Time-AllPages] int > ) >=20 > EXEC sp_xml_removedocument @hDoc OUTPUT This is all I have to work with :-( The xml file is coming from an applica= tion which combines some columns from db & others from the xml form. I hav= e spent a lot of time to get it work because we only need data in a few col= umns 1 442240070 Drv(ACC) 1 1554 GLENCREST CT,SAN JOSE, CA, 95118 1554 GLENCREST CT SAN JOSE, CA, 95118 SAN JOSE CA 95118 CA 01 F BRO BRO 5'06 140 W 09-20-1985 1985 09 20 34 211222 Involved (ACCIDENTS&STR CHKS) 1 2020 TOYT SNA WHI/ CA 1 AAA 1 442240070 Drv(ACC) 1 1554 GLENCREST CT SAN JOSE, CA 95118 CA 34 F 1985 09 20 1 1 1 1 1 1 1 M G SE BRANHAM LN 35 2 442240071 Drv(ACC) 2 1493 CRESTHAVEN LN,SAN JOSE, CA, 95118 1493 CRESTHAVEN LN SAN JOSE, CA, 95118 SAN JOSE CA 95118 CA 01 M BLK BRO 5'6 138 A 09-29-1984 1984 09 29 35 211223 Involved (ACCIDENTS&STR CHKS) 2 2015 VOLK TGN GRY/ CA 1 GEICO 1 442240071 Drv(ACC) 2 1493 CRESTHAVEN LN SAN JOSE, CA 95118 CA 35 M 1984 09 29 1 1 1 1 1 1 1 1 L G W BRANHAM LN 35 SOUTHERN 1 442240071 Drv(ACC) 2 1493 CRESTHAVEN LN SAN JOSE, CA 95118 CA 35 M 1984 09 29 1 1 1 2 L G EMS GOOD SAMARITAN HOSPITAL SWELLING AND BRUISING ON ARMS / DIZZINESS 2 442240072 Inj (ACC) 1 1493 CRESTHAVEN LN SAN JOSE, CA 95118 CA 38 M 1981 12 18 2 L G EMS GOOD SAM = SEAT POS #3 NECK AND CHEST PAIN 1 3 442240073 Inj (ACC) 2 1493 CRESTHAVEN LN SAN JOSE, CA 95118 6 M 2013 09 05 2 L Q EMS GOOD SAM = SEAT POS #4 BLOODY MOUTH 1 4 442240075 Inj (ACC) 3 1493 CRESTHAVEN LN SAN JOSE, CA 95118 3 M 2016 08 11 2 EMS GOOD SAM = SEAT POS #6 ABDOMINAL PAIN 1 SANTA CLARA COUNTY [X] 1 43470 02-01-2020 SUMMARY: On 2-1-20 at about 1547 hrs, emergency services respo= nded to a two-vehicle collision on Branham Ln at Pinmore Dr. Upon police arrival both vehicles wer= e disabled in the roadway. Fire/medics assessed all parties for injuries. STATEMENTS: D-1(White) identified herself as the drive of V-1(Toyt) with = her CDL. D-1 stated that she was making a left turn from the Safeway parking lot to eastbound Br= anham Ln when she was abruptly struck by V-2(Volk). D-1 said she did not see V-2 approached and specu= lated that D-2 may have been speeding. D-1 had a complaint of pain across her neck but decl= ined medical transport. D-2(Joo) identified himself as the driver of V-2(Volk) with h= is CDL. D-2 stated that he was simply driving approximately 35 mph in the #1 lane of westbound= Branham Ln when V-1(Toyt) abruptly pulled out in front of him. D-2 stated that he swerved to avoi= d colliding, however, he had little time to react. INJURIES: All 4 occupants of V-2 were transported by ambulance= for further assessment of minor to moderate injuries. CAUSE: D-1(White) caused the collision when she failed to yiel= d to all vehicles approaching from opposite direction close enough to be a hazard during any part = of the turn in violation of 21801(a) VC. CRAIG,CHRISTOPHER J (3961) 2020-200320523 3961 4313 A1 1 SAN JOSE 4 0 1 21801(a) VC 0 1 1 1 1 1 1 1 1 PINMORE DR BRANHAM LN 02-01-2020 1547