Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2011-02-14 : 05:10:57
|
| I have a table with xml datatype column PartnerResponseIn it i have a data<mailxml:PartnerApptQueryResponse xmlns:mailxml="http://idealliance.org/maildat/Specs/md091/mailxml60d/mailxml"></mailxml:PartnerApptQueryResponse>I wants to update the nodexmlns:mailxml="http://idealliance.org/maildat/Specs/md091/mailxml60d/mailxml"intoxmlns:mailxml="http://idealliance.org/maildat/Specs/md091/mailxml80B/mailxml"How can i do it from sql?Kamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net) |
|
|
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2011-02-14 : 05:30:21
|
| Thanks but it could be better if you can help me in exact queryI were tryingUPDATE [PartnerAppointmentQueryResponse] Set PartnerApptQueryResponseType.modify ('replace value of (/PartnerApptQueryResponse[@xmlns])[1] with "http://idealliance.org/maildat/Specs/md091/mailxml80B/mailxml" ' )Where ConsigneeApptID = 'fg'but it is not working and i am getting errorXQuery [PartnerAppointmentQueryResponse.PartnerApptQueryResponseType.modify()]: The target of 'replace value of' must be a non-metadata attribute or an element with simple typed content, found 'element(PartnerApptQueryResponse,xdt:untyped) ?' |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-02-14 : 06:23:24
|
What is it you are trying to accomplish?You want to change the namespace? N 56°04'39.26"E 12°55'05.63" |
 |
|
|
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2011-02-14 : 06:44:10
|
| Yes Peso [the geek]Kamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net) |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-02-14 : 06:57:17
|
[code]DECLARE @Sample TABLE ( ConsigneeApptID CHAR(2) NOT NULL, PartnerResponse XML NOT NULL )INSERT @SampleSELECT 'fg', '<mailxml:PartnerApptQueryResponse xmlns:mailxml="http://idealliance.org/maildat/Specs/md091/mailxml60d/mailxml"></mailxml:PartnerApptQueryResponse>'-- BeforeSELECT *FROM @Sample-- Do the updateUPDATE @SampleSET PartnerResponse = REPLACE(CAST(PartnerResponse AS NVARCHAR(MAX)), N'xmlns:mailxml="http://idealliance.org/maildat/Specs/md091/mailxml60d/mailxml"', N'xmlns:mailxml="http://idealliance.org/maildat/Specs/md091/mailxml80B/mailxml"')WHERE ConsigneeApptID = 'fg'-- AfterSELECT *FROM @Sample[/code] N 56°04'39.26"E 12°55'05.63" |
 |
|
|
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2011-02-14 : 08:00:44
|
| Thanks PesoKamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net) |
 |
|
|
|
|
|