How to dynamically change the index value with SQL DML

前端 未结 2 1250
情歌与酒
情歌与酒 2021-01-15 03:18

I am a beginner in XML with SQL. How can I specify index within an insert statement as below. The following statement gives throws exception with invalid path to update.

2条回答
  •  轮回少年
    2021-01-15 04:17

    Did you check out this article. http://technet.microsoft.com/en-us/library/ms175466.aspx

    SELECT @myDoc       
    set @myDoc.modify('       
    insert Strong long lasting 
    after (/Root/ProductDescription/Features/Material)[1]       
    ')       
    SELECT @myDoc;
    

    This assumes that the Material tag exists. Is the path (/xyz/abc) valid?

    
      
        
          1 year parts and labor
          3 year parts and labor extended maintenance is available
          Aluminium
          Strong long lasting
        
      
    
    

    Also, test you current code with a literal instead of a sql:variable.

    Again, please post the xml/code.

    Thanks

    John

提交回复
热议问题