SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Loading XML file
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

yyy
Starting Member

5 Posts

Posted - 11/24/2011 :  05:03:57  Show Profile  Reply with Quote
Hi,

I want to load an XML file from the internet to my computer,
or just temporary to my stored procedure,
through a stored procedure.

How can I load the file?

Thanks,
Yael

jimoomba
Yak Posting Veteran

India
90 Posts

Posted - 11/28/2011 :  04:13:02  Show Profile  Reply with Quote
Let me know what all have you tried for this first.

Thanks,
Jim

rams
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 11/28/2011 :  04:36:19  Show Profile  Reply with Quote
quote:
Originally posted by yyy

Hi,

I want to load an XML file from the internet to my computer,
or just temporary to my stored procedure,
through a stored procedure.

How can I load the file?

Thanks,
Yael


you can use OPENROWSET bulk

see

http://msdn.microsoft.com/en-us/library/ms191184.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

yyy
Starting Member

5 Posts

Posted - 11/28/2011 :  05:49:41  Show Profile  Reply with Quote
Hi,

I used the OPENROWSET after I already had the XML file in my machine:

SET @xmlDoc = (SELECT * FROM OPENROWSET (BULK '\\...\indices.xml', SINGLE_BLOB) AS xmlData)

But, I need one step before: I need a way to load the XML file from the internet to my machine, and the following didn't work:

SET @xmlDoc = (SELECT * FROM OPENROWSET (BULK 'http://www1.cbs.gov.il/reader/pirsum_madad/indices.xml', SINGLE_BLOB) AS xmlData)

Thanks ahead,
Yael
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 11/28/2011 :  07:18:26  Show Profile  Reply with Quote
wheres the XML currently? is there a ftp site through which you can get it?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

yyy
Starting Member

5 Posts

Posted - 11/28/2011 :  07:43:31  Show Profile  Reply with Quote
Hi,

The XML is in the following address:
http://www1.cbs.gov.il/reader/pirsum_madad/indices.xml
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 11/28/2011 :  07:46:42  Show Profile  Reply with Quote
do you've a webservice method through which you can call and get this xml to db?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

yyy
Starting Member

5 Posts

Posted - 11/28/2011 :  08:08:19  Show Profile  Reply with Quote
No... Is there a way to do it directly throgh the SQL stored procedure?
I don't need to save the file in my machine, just to use its data in the SQL.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 11/28/2011 :  08:19:00  Show Profile  Reply with Quote
try this

http://www.mandsconsulting.com/request-xml-from-url-in-ssis-c-script-task

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

yyy
Starting Member

5 Posts

Posted - 11/28/2011 :  08:41:29  Show Profile  Reply with Quote
First, Thanks a lot for your help!!

I see that this explains how to load the XML in C#, but I need this in SQL
(I need to do a task that will be done automatically once per day, so I don't think that I can do it in C#).

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 11/28/2011 :  08:43:01  Show Profile  Reply with Quote
quote:
Originally posted by yyy

First, Thanks a lot for your help!!

I see that this explains how to load the XML in C#, but I need this in SQL
(I need to do a task that will be done automatically once per day, so I don't think that I can do it in C#).




nope. that C # code can be called inside SSIS package which can be called via SQL job for automatic execution

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000