/ Published in: SQL

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Adding element INTO the XML DATA INSERT Expression1 ( {AS FIRST | AS LAST} INTO | after | BEFORE Expression2 ) SET @xmlDoc.modify(' insert element UpdateDatetime {"2010-10-28T13:49:27.330"} before or after (/t/AuditID)[1] ') SET @xmlDoc.modify(' insert <UpdateDatetime>2010-10-28T13:49:27.330</UpdateDatetime> as last or as first or into(/t)[1]') IF (@xmlDoc.exist('/t/UpdateDatetime')=0) BEGIN SET @xmlDoc.modify(' insert <UpdateDatetime>2010-10-28T13:49:27.330</UpdateDatetime> as last into(/t)[1]') END *Adding element WITH dynamic DATA FROM the sp parameters WITH condition. IF (@xmlDoc.exist('/t/UpdateDatetime')=0) BEGIN SET @xmlDoc.modify(' insert element UpdateDatetime {sql:variable("@dtmCurrentDate")} as last into(/t)[1]') END
Comments
