home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 19,300 of 19,505   
   chris H to Erland Sommarskog   
   Re: Unable to query xml data in sql serv   
   10 Jun 20 13:05:11   
   
   From: 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   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca