Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #2041
| Newsgroups | comp.databases.ms-sqlserver |
|---|---|
| Date | 2020-06-10 13:05 -0700 |
| References | <b8df0410-a799-45e8-b128-4c8a62b38ed6o@googlegroups.com> <XnsABD8DEF547D6EYazorman@127.0.0.1> |
| Message-ID | <25356606-299b-4623-809d-0d6eb9af0906o@googlegroups.com> (permalink) |
| Subject | Re: Unable to query xml data in sql server |
| From | chris H <chris.sjpd@gmail.com> |
On Wednesday, June 10, 2020 at 12:55:06 PM UTC-7, Erland Sommarskog wrote:
> chris H (chris.sjpd@gmail.com) writes:
> > WITH
> > (
> > 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
> > )
> >
> >
> > Here is the error:
> > Msg 102, Level 15, State 1, Line 32
> > Incorrect syntax near '-'.
> >
>
> The name you have to the left is a column name, and must follow the regular
> syntax for identifiers. Hyphen is not a permitted character in an
> identifier.
>
> You need to wrap these names in double quotes or bracket. These delimiters
> permits you to have about any column name.
>
> For instance:
>
> [PedestrianActionA-AllPages] int,
> "MotorVehicleInvolvedWithC-AllPages" int,
>
> "" and[] are equivalent. "" is the ANSI standard. [] is the Microsoft way.
Hi Erland,
Thank you for the suggestion. The codes do not error out anymore; however, it does not give me the value. Am I missing something?
SELECT *
FROM OPENXML(@hDoc, '/Agency', 1)
WITH
(
[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
)
Really appreciate your helps.
Sincerely,
Chris
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar
Unable to query xml data in sql server chris H <chris.sjpd@gmail.com> - 2020-06-10 09:29 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-06-10 21:55 +0200
Re: Unable to query xml data in sql server chris H <chris.sjpd@gmail.com> - 2020-06-10 13:05 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-06-10 23:42 +0200
Re: Unable to query xml data in sql server chris H <chris.sjpd@gmail.com> - 2020-06-10 14:50 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-06-11 00:15 +0200
Re: Unable to query xml data in sql server chris H <chris.sjpd@gmail.com> - 2020-06-10 15:30 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-06-11 21:04 +0200
Re: Unable to query xml data in sql server chris <chris.sjpd@gmail.com> - 2020-06-12 15:54 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-06-13 10:36 +0200
Re: Unable to query xml data in sql server chris <chris.sjpd@gmail.com> - 2020-06-17 13:13 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-06-18 08:29 +0200
Re: Unable to query xml data in sql server chris <chris.sjpd@gmail.com> - 2020-06-18 16:30 -0700
Re: Unable to query xml data in sql server chris <chris.sjpd@gmail.com> - 2020-06-18 16:47 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-06-19 10:24 +0200
Re: Unable to query xml data in sql server chris <chris.sjpd@gmail.com> - 2020-06-29 16:56 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-06-30 20:39 +0200
Re: Unable to query xml data in sql server chris <chris.sjpd@gmail.com> - 2020-07-13 14:25 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-07-14 11:49 +0200
Re: Unable to query xml data in sql server chris <chris.sjpd@gmail.com> - 2020-07-14 09:56 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-07-14 19:59 +0200
Re: Unable to query xml data in sql server chris <chris.sjpd@gmail.com> - 2020-07-15 15:20 -0700
Re: Unable to query xml data in sql server chris <chris.sjpd@gmail.com> - 2020-08-04 09:17 -0700
Re: Unable to query xml data in sql server Erland Sommarskog <esquel@sommarskog.se> - 2020-08-04 21:29 +0200
csiph-web