Create stored Procedure to get xml data fields

  • I have a table with more than one xml fields in Sql server 2005 databse.I need to create a stored procedure for getting all

    the xml fields ..Please let me know

  • something like this?

    SELECT cast('<root>' + cast(xmlcol1 as nvarchar(max)) + cast(xmlcol2 as nvarchar(max))+'</root>' as xml) FROM yourtable

  • Hi

    I dont knw what exactly you mean..I am new to stored procedure and xml data field..So Please provide some eg with code

  • Passing Multiple Parameters to a Stored Procedure

    1.Define your parameter in your stored procedure as xml

    IE: @DEPART XML

    The parameter now acts and behaves like a table

    IE: INNER JOIN @DEPART.nodes('/DEPART/LOCATION_DESC') as m(item)

    on cast(TL.TK_LOCATIONS_UID as VARCHAR(10))

    = m.item.value('TK_LOCATIONS_UID[1]','VARCHAR(10)')

    2.Dataset Alter Parameter section:

    =Code.ReturnXML(Parameters!DEPART.Value,"DEPART","LOCATION_DESC","TK_LOCATIONS_UID")

    3.In the Report Properties Code section:

    Function ReturnXML(ByVal MultiValueList As Object, ByVal DEPART As String, ByVal LOCATION_DESC As String, ByVal TK_LOCATIONS_UID As String) As String

    Dim ReturnString = ""

    Dim sParamItem As Object

    ReturnString = " "

    For Each sParamItem In MultiValueList

    ReturnString &= " "

    Next

    ReturnString &= " "

    Return (ReturnString)

    End Function

    Note in this example: Parameter = Depart Value= TK_LOCATIONS_UID Label=LOCATION_DESC

  • Thanks alot!!I will try and let you know

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply