Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / XML / July 2008

Tip: Looking for answers? Try searching our database.

xs:dateTime does not accepts ISO 8601 local time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SammyBar - 30 Jun 2008 22:31 GMT
Hi,

I'm validating a Xml against a schema but I get error validating ISO 8601
datetime value.

The fragment of the schema is
<xs:attribute name="fecha" use="required">
   <xs:simpleType>
       <xs:restriction base="xs:dateTime">
           <xs:whiteSpace value="collapse"/>
       </xs:restriction>
   </xs:simpleType>
</xs:attribute>

The value that contains the field "fecha" is '2008-06-30T14:52:00'

It is supposed to be a valid ISO 8601 local time but the schema rejects it.
Only when using '2008-06-30T14:52:00Z' the schema accepts the value. But in
order to do that I should convert my datetime to UTC which I'm trying to
avoid.
Is it any way to fix the schema declaration to accept ISO 8601 local
datetime?

This problem was present when using typed xml data type in Sql Server 2005.

Any hint is welcomed
Thanks in advance
Sammy
Michael Coles - 01 Jul 2008 01:26 GMT
SQL 2005 requires a time offset.  You can replace the Z with your local time
offset, like -05:00 for Eastern time, like this:

2008-06-30T14:52:00-05:00

Keep in mind that SQL Server "normalizes" xs:dateTime values to Z time, so
it will literally store the value above as:

2008-06-30T09:52:00Z

This behavior is changed in SQL Server 2008.  One alternative is to create a
type derived from xs:string that restricts it's content to the desired
format.

Signature

========
Michael Coles
"Pro SQL Server 2008 XML"
http://www.amazon.com/Pro-SQL-Server-2008-XML/dp/1590599837/

> Hi,
>
[quoted text clipped - 25 lines]
> Thanks in advance
> Sammy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.