Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 SQL Server 6.5 \ SQL Server 7.0
 create xml file from tables for web services

Author  Topic 

a0f6459
Starting Member

4 Posts

Posted - 2008-05-27 : 17:26:10
Hi,

I am pretty new to XML and webservices. Basically I have a table that is loaded every few hours by a DTS package. After each load, I want to create an XML to be sent through webservices. How do I write a stored procedure to convert the contents of the table into XML?

Any help would be greatly appreciated.

Thanks

Andrew

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-27 : 17:29:45
You've posted in the 6.5/7.0 forum. Are you really using one of these versions?

If you are using at least version 2000, then you can use the FOR XML clause.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

a0f6459
Starting Member

4 Posts

Posted - 2008-05-27 : 17:31:44
I've been told by our admin that it is SQL 7.0

Is that going to be a problem?

Andrew

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-27 : 17:47:25
Yes. XML-support was not added until SQL Server 2000.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

a0f6459
Starting Member

4 Posts

Posted - 2008-05-27 : 17:51:39
I just googled the FOR XML clause and tried it in the query analyzer with the table I want, it seems to work, so I'm not sure what version it is.

How do I go from just a display in query analyzer to creating an XML file?

Thanks

Andrew

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-27 : 18:25:40
Creating the XML file is outside of the scope of SQL Server. You'd do that at the web service level via your programming language such as C#.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page
   

- Advertisement -