Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
companionz
Yak Posting Veteran
54 Posts |
Posted - 2009-10-05 : 06:53:55
|
| Hello,I need to create a procedure which will take an array as input. Has anyone created any such proc ?We can do the same in Oracle but how to do that in SQL server?Thanks,Sourav |
|
|
smarty
Starting Member
13 Posts |
Posted - 2009-10-05 : 09:54:11
|
| You could use XML as the input and convert that back to a table using OPENXMLFor reference http://msdn.microsoft.com/en-us/library/ms187367.aspxExampleDECLARE @InputXML AS NVARCHAR(MAX)DECLARE @hDoc INTSET @InputXML = '<XPATH><Node>value</Node><Node>value2</Node></XPATH>'EXEC sp_xml_preparedocument @hDoc OUTPUT, @InputXMLSELECT * FROM OPENXML(@hDoc, '/XPATH/Node') WITH (NodeNAme VARCHAR(300) '.')EXEC sp_xml_removedocument @hDoc-----------------------------------Free SQL server monitoring for DBA'swww.realsmartsoftware.co.uk |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
smarty
Starting Member
13 Posts |
Posted - 2009-10-05 : 10:56:50
|
quote: Originally posted by X002548 What version of SQL Server?I believe version 2008 has this ability now...I'm stuck on 2k5 for the moment
Correct - You can have table valued parameters in SQL2008-----------------------------------Free SQL server monitoring for DBA'swww.realsmartsoftware.co.uk |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-05 : 14:06:45
|
quote: Originally posted by companionz Hello,I need to create a procedure which will take an array as input. Has anyone created any such proc ?We can do the same in Oracle but how to do that in SQL server?Thanks,Sourav
http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm |
 |
|
|
|
|
|