不同的结果-SQL Server和PHP(PEAR DB)


Different results - SQL Server and PHP (PEAR DB)

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

在PHP中,我已经在设置:

"设置ANSI_NULLS ON"answers"设置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中使用的安全日期时间字符串格式是

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

SQL错误:将varchar数据类型转换为datetime数据类型导致值超出范围

已解决

解决方案:

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

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

SQL错误:将varchar数据类型转换为datetime数据类型导致值超出范围