Hello,
I'm trying to translate the following statement from XQUF to Sedna XQuery
Update:
for $t in /ACCOUNTS/ACCOUNT
where $t/INACTIVE_DATE = ''
return (insert node
<DAYS_SINCE_ACTIVATION>
{days-from-duration(current-
date() - xs:date($t/ACTIVE_DATE))}
</DAYS_SINCE_ACTIVATION> after $t/INACTIVE_DATE)
I've managed to achieve the desired result using the "replace" statement as
follows:
UPDATE
replace $p in doc("accounts-t")/ACCOUNTS/ACCOUNT[INACTIVE_DATE =
'']/INACTIVE_DATE
with
($p,
for $s in $p
return <DAYS_SINCE_ACTIVATION>
{days-from-duration(current-date() -
xs:date($p/parent::node()/ACTIVE_DATE))}
</DAYS_SINCE_ACTIVATION>)
However, I'd prefer to have the query formulated using "insert" statement,
as in the original. Is it possible to do this? The <DAYS_SINCE_ACTIVATION>
element should be placed after <INACTIVE_DATE>.
Any help much appreciated!
Best regards,
Andrzej Śliwiński
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Sedna-discussion mailing list
Sedna-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sedna-discussion