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
 
Back
Top