By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,766 Members | 1,295 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,766 IT Pros & Developers. It's quick & easy.

Load XML souce file to a SP parameter

P: n/a
I have a proc like this (T-SQL, SQL Server 2000):

Alter Proc ImportXML
@chvFullFileName varchar(200),
@txtInputXML text=''
AS

My question is how can I load the contents of the XMLFile into the
parameter called @txtInputXML ? Let us say my full file path is
C:\XML\SampleXML.txt. I want to load this into parameter as one string

What do I use ? bulkcopy or something else ?

Your help would be much appreciated.

Thanks

May 2 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
(vi*****@gmail.com) writes:
I have a proc like this (T-SQL, SQL Server 2000):

Alter Proc ImportXML
@chvFullFileName varchar(200),
@txtInputXML text=''
AS

My question is how can I load the contents of the XMLFile into the
parameter called @txtInputXML ? Let us say my full file path is
C:\XML\SampleXML.txt. I want to load this into parameter as one string

What do I use ? bulkcopy or something else ?


From a client program read the file and then call the procedure.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
May 2 '06 #2

P: n/a
Erland:

Thanks for the reply. Understand your point.
But do not want to use a client program or VB.
Is there a way I can load the file directly from SQL ?

Thanks again

May 2 '06 #3

P: n/a
Erland:

Thanks for the reply. Understand your point.
But do not want to use a client program or VB.
Is there a way I can load the file directly from SQL ?

Thanks again

May 2 '06 #4

P: n/a
(vi*****@gmail.com) writes:
Thanks for the reply. Understand your point.
But do not want to use a client program or VB.
Is there a way I can load the file directly from SQL ?


You could use BULK INSERT to load the file into a table. But then you will
not be able to get the XML document out of the table and into a variable,
because you cannot assign to text variables. (If the document is small
you can use nvarchar(4000) or varchar(8000).)

Depending on what you want to do, a better bet may be the XML bulk load
that comes with SQLXML 3.0, which is freely downloadable from Microsoft.
I have never used it myself, so I cannot assist with it.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
May 3 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.