Last post Jun 17, 2013 07:19 AM by zoggling
Jun 12, 2013 04:48 AM|zoggling|LINK
We have numerous XML documents which contain dates in the format dd/mm/yyyy, for example:
However, this date format does not appear to be recognised by the xs:date() constructor function in the following T-SQL, with an error occuring:
@xml xml =
SET @bit = @xml.exist('declare namespace ns="http://tempuri.com/request.xsd"; //ns:mydate[xs:date(text()) cast as xs:date? = xs:date("13/01/2013")]')
Msg 9319, Level 16, State 1, Line 14
XQuery [exist()]: Static simple type validation: Invalid simple type value '13/01/2013'.
Dates in the format yyyy-mm-dd work fine, however modifying the tool that generates the XML is not currently an option. Can anyone please suggest how I can update the XQuery to deal with date values in the format dd/mm/yyyy? This is for a SQL Server stored
Jun 13, 2013 03:31 AM|zoggling|LINK
If only fn:tokenize was supported by XQuery in SQL Server... then we might have a solution:
Jun 13, 2013 04:37 AM|Pengzhen Song - MSFT|LINK
We are happy that your issue has been resolved.
Jun 17, 2013 07:19 AM|zoggling|LINK
It hasn't! I am using SQL Server 2012 and don't have a suitable workaround yet...