passing array to stored procedure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi al
can u plz give me an example to passing array to stored procedure for sql serve
than
Mukunda
 
Hi,

You can't pass an array and sql server procedure doesn't support an array
parameters afaik.
 
You can pass in an XML structure that could contain the rows/columns that would mimic the array. The XML below could be cleaned up, but this is just what was thrown together

DECLARE @xml nvarchar(1000)
@docHandle in

SET @xml =
'<root><clients><client><clientid>5</clientid><name>bob</name></client><client><clientid>6</clientid><name>josh</name></client></clients></root>

EXEC sp_xml_preparedocument @docHandle OUTPUT, @xml

SELEC
clientid
nam
FROM
OPENXML (@docHandle, '/root/clients/client',2) WITH (clientid int
name nvarchar(25))
EXEC sp_xml_removedocument @docHandle

hth
 

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