How to use IF/ELSE statement to update or create new xml node entry in Sql

前端 未结 3 2056
名媛妹妹
名媛妹妹 2020-12-02 00:33

Example:


    
        Lopez, Michelle MD
        Spanish
        

        
3条回答
  •  借酒劲吻你
    2020-12-02 01:40

    You might want to just try replacing:

    set @locAnchor = ('' + 
    @locTitle + '');
    

    with:

    SELECT @locAnchor = (SELECT 'theloc.aspx?id=' + @locID AS 'Value6/a/@href',
    @locTitle AS 'Value6/a/@title',
    @locTitle AS 'Value6/a'
    FOR XML PATH (''))
    

    instead of trying to dynamically create the XML

提交回复
热议问题