简体   繁体   English

具有公式编辑器值的Crystal Report SQL查询命令参数

[英]Crystal Report SQL Query command paramter with formula editor value

I'm using crystal report builder and I need to pass to the SQL Server a query with date limitation by Crystal Report parameters. 我正在使用Crystal Report Builder,并且我需要将带有Crystal Report参数限制日期的查询传递给SQL Server。

My SQL table store the datetime as bigint (UTC TICKS). 我的SQL表将日期时间存储为bigint(UTC TICKS)。

The user send the parameter for the report selection by calendar selection tool so the received parameter is datetime for the crystal report. 用户通过日历选择工具发送用于报表选择的参数,因此接收到的参数是Crystal报表的日期时间。

Ho can I perform a query in SQL Command (Crystal Report - command) after changing the parameter value/type? 更改参数值/类型后,如何在SQL命令(Crystal Report-命令)中执行查询? Can I use a formula to change the parameter before using it in the command? 在命令中使用公式之前,可以使用公式来更改参数吗?

For example: ShiftDateTime({@CreationTime},"UTC,0", "") 例如:ShiftDateTime({@ CreationTime},“ UTC,0”,“”)

Thanks! 谢谢!

I found the answer: 我找到了答案:

bigint to date: select dateadd(minute ,cast((8123371500/60) as bigint),cast('1753-01-01' as datetime)) 迄今为止的bigint:选择dateadd(分钟,cast((8123371500/60)作为bigint),cast('1753-01-01'作为datetime))

date to bigint : select cast(DateDiff(minute,'1753-01-01','2010-06-03 12:05:33') as bigint)*60 date到bigint:选择cast(DateDiff(minute,'1753-01-01','2010-06-03 12:05:33')作为bigint)* 60

thanks anyway. 不管怎么说,还是要谢谢你。

Shai.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM