The sum of all SQL Server matter that exist,
and the space in which all SQL Server events
occur or could occur.
Welcome to SQL Server Universe.com Sign in | Join | Help
in
Home SS SLUG Forums Articles Photos Downloads

How to pass complex object in to sql server 2005 stored procedure ??

Last post 05-16-2008, 14:09 by idalugama@gmail.com. 4 replies.
Sort Posts: Previous
  • How to pass complex object in to sql server 2005 stored procedure ??

     05-16-2008, 9:05

    • Joined on 05-16-2008
    • Posts 10
    • Points 0
    • Top 25 Contributor

    hi all

    I have requirement  to pass complex object ( let's say xml document  ,student collection ) to stored procedure , how do i do this in sql server 2005

     

    thanks & BR

    indika dalugma 

     

  • Re: How to pass complex object in to sql server 2005 stored procedure ??

     05-16-2008, 10:01

    • Joined on 11-22-2006
    • Colombo, Sri Lanka
    • Posts 208
    • Points 0
    • Top 10 Contributor
      Male

    Indika,

    SQL Server 2005 introduced the XML data type, which can be used to pass your object into the stored procedure. Within the stored procedure you could use XQuery functions (which are supported by SQL Server 2005) to manipulate the value passed to it.

    Regards


    Gogula G. Aryalingam (MVP - SQL Server)

    DB Antics

  • Re: How to pass complex object in to sql server 2005 stored procedure ??

     05-16-2008, 10:29

    • Joined on 05-16-2008
    • Posts 10
    • Points 0
    • Top 25 Contributor

    he thax for your replay ,

    let say my xml as follows 

    <ManuInstructions>
    <Location LocationID="L1" >
      <Step>Manu step 1 at Loc 1</Step>
      <Step>Manu step 2 at Loc 1</Step>
      <Step>Manu step 3 at Loc 1</Step>
    </Location>
    <Location LocationID="L2" >
      <Step>Manu step 1 at Loc 2</Step>
      <Step>Manu step 2 at Loc 2</Step>
      <Step>Manu step 3 at Loc 2</Step>
    </Location>
    </ManuInstructions>

    So how could i iterate this two <location> elements and insert into my table , if you have any simple sample stored procedure please send me

  • Re: How to pass complex object in to sql server 2005 stored procedure ??

     05-16-2008, 13:26

    • Joined on 11-22-2006
    • Colombo, Sri Lanka
    • Posts 208
    • Points 0
    • Top 10 Contributor
      Male

    Hi,

    I don't have a sample procedure as of now, but you could certainly refer this article http://www.sqlservercentral.com/articles/XML/62290/, and also maybe refer this http://msdn.microsoft.com/en-us/library/ms190945.aspx, where they give some examples on the same XML code that you've got up there...

    Regards


    Gogula G. Aryalingam (MVP - SQL Server)

    DB Antics

  • Re: How to pass complex object in to sql server 2005 stored procedure ??

     05-16-2008, 14:09

    • Joined on 05-16-2008
    • Posts 10
    • Points 0
    • Top 25 Contributor

    HI Gogula G

    really than you for above link's

     

    best reguard

    indika  Big Smile 

View as RSS news feed in XML

(Best viewed with a resolution of more than 1024 * 768)

Powered by Community Server, by Telligent Systems