I want to use the option 'byte order mark off' in an openxml-query.

example :

select * from openxml(test_xml,'//*')
with (T_ID bigint '@mp:id')
option (byte order mark off)

syntax-error near 'order'

I use sql anywhere 12.0.1 (3840)

What is the correct syntax ?

asked 22 May '13, 08:38

Jaak%20Thijs's gravatar image

Jaak Thijs
131479
accept rate: 50%

edited 22 May '13, 08:48

Mark%20Culp's gravatar image

Mark Culp
22.6k9129265


According to the 12.0.1 documentation for openxml() you need to use Syntax 2 if you want to specify an OPTION clause and therefore you need to preface your test_xml value with either USING FILE or USING VALUE. In my tests I have verified that without the USING FILE or USING VALUE I get the same syntax error but after adding a prefix I no longer do.

You also need to give a name to your derived table which is created using openxml().

So assuming your variable test_xml has your XML data then try:

select * 
  from openxml( USING VALUE test_xml, '//*' )
          with ( T_ID bigint '@mp:id' )
        option ( byte order mark off )
            as dt;
permanent link

answered 22 May '13, 09:03

Mark%20Culp's gravatar image

Mark Culp
22.6k9129265
accept rate: 40%

edited 22 May '13, 09:07

It works. Thanks !

(22 May '13, 09:27) Jaak Thijs
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×406
×11

question asked: 22 May '13, 08:38

question was seen: 645 times

last updated: 22 May '13, 09:38