473,387 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Load XML souce file to a SP parameter

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
4 1353
(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
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
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
(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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Arti Potnis | last post by:
Hi, I am trying to execute the DB2 load utility from a C program. lPid = fork(); execl(csExePath, csExeName,csCmd, NULL); the contents of the parameter variables are as follows:-
4
by: veronica24 | last post by:
I need some help. I am currently running a load script on db2 version 7 on an AIX 5.1.02 server in our production environment. We have upgraded our test server with db2 version 8 AIX 5.2..03. ...
4
by: Gary Davis | last post by:
Once a day or so, I receive an error on a fairly active website that calls this StrMixed.cs method constructor. 99% of the time there is no exception: System.Web.HttpUnhandledException:...
3
by: user | last post by:
Hello I finally managed to save Bitmap that reprezented my pictureBox to jpg file, but now how can i load from that file to Bitmap again ? Bitmap does not have any Load or Open method (like...
1
by: Rogerio Leite via .NET 247 | last post by:
Friends please send me a souce code corrent article. -------------------------------- From: Rogerio Leite ----------------------- Posted by a user from .NET 247 (http://www.dotnet247.com/) ...
3
by: db2udbgirl | last post by:
Env: DB2 UDB 8.2, AIX 5.3 While trying to load data (73 Million rows, Medium size table uses 4K tablespace) into a table using cursor it fails with "SQL0964C The transaction log for the database...
19
by: natG | last post by:
On a warehouse app, our Java clients constantly load/insert rows into the db. I would like to throttle these inserts (1.5 million rows per hr) from the Java app, based on current 'busy state' of...
0
by: kamboj.shalabh | last post by:
Hi to all, Well, I am working on dotnet 2005 with crystal reports 10 and backend as sql server. I am facing a problem while loading a report. Actually the issue is, when I load report it takes...
4
by: db2admin | last post by:
Hello, If i import data into tables, import will write all warnings in message file and will tell me why any exception row is rejected. I wanted to get exception rows in seperate table which i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.