开发者

Crystal Reports and SQL Server 2008 datetimeoffset

开发者 https://www.devze.com 2023-02-18 17:23 出处:网络
SQL Server 2008 introduced new data type datetimeoffset which stores local time and offset between local time and UTC. But when a table containing datetimeoffset column is added to Crystal Reports 200

SQL Server 2008 introduced new data type datetimeoffset which stores local time and offset between local time and UTC. But when a table containing datetimeoffset column is added to Crystal Reports 2008, the datetimeoffset column is exposed as string in CR Field Explorer rather than DateTime. Is there a way to manipulate datetimeoffset to get the date, time and offset values in CR 2008 other than string convers开发者_运维知识库ion? Is there a DateTimeOffset data type in CR 2010?

Sample of datetimeoffset string as displayed in CR 2008:

2009-08-14 16:37:32.0000000 +07:00


This is the kind of impedance that can easily be countered with a view.

You could create a view representation of that table (or all tables that have the datetime offsets) and use SQL Server's native functions to convert the problematic date time fields into a result set that Crystal Reports can consume without having to resort to string parsing.

If you don't want to bother with a view you can also just write a query that converts from datetimeoffset to a datetime thusly.

0

精彩评论

暂无评论...
验证码 换一张
取 消