newbie: Need feedback about this!

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

hey

asp.net 2.0

I have an array of strings which I need to send in as a parameter to a
stored proedure. As far as I know it's impossible to send an array into a
stored procedure. But I think a stored procedure accepts xml files as a
parameter. So I thought to create a DataSet and populate it with my array of
strings. Then use DataSet.WriteXml to generate the xml file.. Send this XML
file as a input parameter into the stored procedure and use OPENXML to loop
through the records in the xml file....

Is this a good way of doing it?...

Jeff
 
Jeff,

This is one of two ways I can think about sending sets of arbitrary
lengths to stored procedures (personally, I'd love a way to send an array as
well). Writing the XML could be prohibitive as well.

You also could create a temp table that you insert the records into, and
then access that table from your stored procedure.

Hope this helps.
 
Yet another approach is to send the array of strings as a single delimited
string (say, '|' separated) and parse it out in the stored proc.

hey

asp.net 2.0

I have an array of strings which I need to send in as a parameter to a
stored proedure. As far as I know it's impossible to send an array into a
stored procedure. But I think a stored procedure accepts xml files as a
parameter. So I thought to create a DataSet and populate it with my array of
strings. Then use DataSet.WriteXml to generate the xml file.. Send this XML
file as a input parameter into the stored procedure and use OPENXML to loop
through the records in the xml file....

Is this a good way of doing it?...

Jeff
 
hey

asp.net 2.0

I have an array of strings which I need to send in as a parameter to a
stored proedure. As far as I know it's impossible to send an array into a
stored procedure. But I think a stored procedure accepts xml files as a
parameter. So I thought to create a DataSet and populate it with my array of
strings. Then use DataSet.WriteXml to generate the xml file.. Send this XML
file as a input parameter into the stored procedure and use OPENXML to loop
through the records in the xml file....

Is this a good way of doing it?...

Jeff
If your database can parse Comma Separated Variable (CSV) files, then
that would be an alternative way of sending the strings.

rossum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top