Getting xml out of SQL Server

Getting xml out of SQL Server

Post by Simon Harve » Sat, 12 Jul 2003 23:58:06



Hi everyone,

I need to be able to get data out of the server and into a simple xml
representation. I think this should be really very easy. However having
tried to use the extension that was added to SQL Server 2000, which was
supposed to help with just this very problem, I have been left wondering if
there is an easier way. All I want is if there is a table that contain x
amount of row, then that means i want x amount of row elements times the
number of columns in the database. It should be very easy to make a class
that does that but i was wondering if anyone knows of a ready made java
class or someother approach to the problem?

Kindest thanks

Simon

 
 
 

Getting xml out of SQL Server

Post by Ed Y » Sun, 13 Jul 2003 12:21:07


Most OR Mapper allows this kind of transformation, check google for Java OR
Mapper.


Quote:> Hi everyone,

> I need to be able to get data out of the server and into a simple xml
> representation. I think this should be really very easy. However having
> tried to use the extension that was added to SQL Server 2000, which was
> supposed to help with just this very problem, I have been left wondering
if
> there is an easier way. All I want is if there is a table that contain x
> amount of row, then that means i want x amount of row elements times the
> number of columns in the database. It should be very easy to make a class
> that does that but i was wondering if anyone knows of a ready made java
> class or someother approach to the problem?

> Kindest thanks

> Simon


 
 
 

1. Getting XML from SQL server 2000 with store procedure

Hi,

I have created a stored procedure that generates XML using
the "FOR XML <MODE>" clause.

I would like to get the XML document produced by executing
the stored procedure.

I'm working in Visual Basic 6.0, ADO 2.6 and MSSQL 2000.

I think the code should be something like that:

Public Function getXML() As MSXML2.DOMDocument

    Dim strmObj As ADODB.Stream
    Set strmObj = New ADODB.Stream
    cmndObj.Dialect = "{5D531CB2-E6Ed-11D2-B252-
00C04F681B71}"

    cmndObj.CommandType = adCmdStoredProc
    cmndObj.CommandText = "up_xml_test"
    strmObj.Open
    cmndObj.Properties("Output Stream") = strmObj
    cmndObj.Execute
    strmObj.Position = 0
    strmObj.Charset = "UTF-8"
    Set getXML = New MSXML2.DOMDocument
    getXML.loadXML (strmObj.ReadText)
End Function

but i get an error when executing the cmndObj.execute line.

2. Help with Microsoft ACCESS, please

3. Getting SQL Server XML through ADO into Delphi

4. DB with suspect information

5. SQL Server time outs

6. How to get sql installation directory programmatically?

7. Unexpected proxy dial-outs w/ SQL Server 7 EM and MSP 2.0

8. PO8i on Win98

9. MS SQL Server 2000 time-outs periodicly over the internet

10. SQL Server ODBC connection time-outs?

11. Generating Schema compliant XML from SQL Server Database using SQLXML and XML Explicit -- [Performance/Maintenance issues]

12. SQL Server 2K, XML/XSL for Explicit problem with passing XML paramters values