【问题标题】:Different results - SQL Server and PHP (PEAR DB)不同的结果 - SQL Server 和 PHP (PEAR DB)
【发布时间】:2017-04-04 17:33:25
【问题描述】:

我正在尝试使用 php pear db 运行查询,但没有返回任何值。但是,当我使用 SQL Server 运行时,我会得到数据

我已经在 PHP 中设置:

“SET ANSI_NULLS ON”和“SET ANSI_WARNINGS ON”

查询:

select A.nome, count(sa.id_sala) as Atendimentos, cast( avg( case when (coalesce(sa.dt_final, sa.dt_ping_internauta) > sa.dt_inicio_atendimento) then datediff(minute, coalesce(sa.dt_inicio_atendimento, sa.dt_inicio), coalesce(sa.dt_finalAtendimento, coalesce(sa.dt_final, sa.dt_ping_internauta)) ) else 0 end ) as money) as [media em minutos] from sala SA join atendente A on (A.id_atendente = SA.fk_id_atendente) where sa.interno = 0 and coalesce(sa.dt_inicio_atendimento, sa.dt_inicio) between '2012-01-01' and '2012-12-31' and SA.fk_id_empresa = 1 group by A.nome order by 2 desc

已解决

解决方案:

"在 SQL Server 中使用的安全日期时间字符串格式是

YYYYMMDD HH:MM:SS 或 YYYY-MM-DDTHH:MM:SS。"

SQL Error : The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

【问题讨论】:

  • 请添加您的解决方案作为答案。

标签: php sql sql-server pear


【解决方案1】:

已解决

解决方案:

"在 SQL Server 中使用的安全日期时间字符串格式是

YYYYMMDD HH:MM:SS 或 YYYY-MM-DDTHH:MM:SS。"

SQL Error : The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-04
    • 1970-01-01
    相关资源
    最近更新 更多