XQuery has no built-in capability to parse SQL or to execute the result after parsing.
You could generate an XQuery parser for a subset of SQL using REx (http://www.bottlecaps.de/rex/), which would give you an XML representation of the SQL command, and you could then write an XSLT or XQuery program that transforms this into your desired output. Michael Kay Saxonica > On 10 Aug 2017, at 07:07, [email protected] wrote: > > > Hi, > > I know that XQuery is typically used for transforming XML into other > text file formats. > > But is it possible to use XQuery for the other way round? > > I want to transform a very simple SQL Create Table statement into XML. > > > SQL > === > > CREATE TABLE mytable1 > > ( > FIELD1 xxx; > FIELD2 xxx; > FIELD3 xxx; > ); > > COMMENT ON COLUMN mytable1.FIELD1 'Description1'; > COMMENT ON COLUMN mytable1.FIELD2 'Description2'; > > CREATE TABLE mytable2 > > ( > FIELD1 xxx; > FIELD2 xxx; > FIELD3 xxx; > ); > > COMMENT ON COLUMN mytable2.FIELD1 'Description1'; > COMMENT ON COLUMN mytable2.FIELD3 'Description3'; > > > XML > === > > <table> > <title>mytable1</title> > <column> > <name>FIELD1</name> > <comment>Description1</comment> > </column> > <column> > <name>FIELD2</name> > <comment>Description2</comment> > </column> > <column> > <name>FIELD1</name> > <comment></comment> > </column> > </table> > > <table> > <title>mytable2</title> > <column> > <name>FIELD1</name> > <comment>Description1</comment> > </column> > <column> > <name>FIELD2</name> > <comment></comment> > </column> > <column> > <name>FIELD1</name> > <comment>Description3</comment> > </column> > </table> > > Can this be done via XQuery? If not which tool could possibly fit my needs? > > Best regards > Michael > _______________________________________________ > [email protected] > http://x-query.com/mailman/listinfo/talk _______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
