有如下SQL,为什么不能执行?我在SQL Server的查询分析器和SQL Explorer中试过都可以执行
但是为什么在程序里用TQuery执行不了呢?错误提示如下:
Invalid use of keyword
Token:char(8),pTo_Datetime-"8:00:00",122)
Line Number: 1.SQL语句如下:
Select convert(char(8),pTo_Datetime-"8:00:00",112) as WorkDate,
processorID,
(select OpName from operator b where a.processorid = b.opid) as processorname,
worknode = case workflow_node
when "1" then "11"
when "2" then "22"
when "3" then "33"
when "4" then "44"
when "5" then "55"
end,
count(workflow_node) as SHULIANG from job_log a
where process_status = "2"
and convert(char(8),pTo_Datetime-"8:00:00",112) >= "20021006"
and convert(char(8),pTo_Datetime-"8:00:00",112) <= "20021016"
group by convert(char(8),pTo_Datetime-"8:00:00",112),
processorID,workflow_node order by workdate desc,processorID
在线等待,谢谢大侠
但是为什么在程序里用TQuery执行不了呢?错误提示如下:
Invalid use of keyword
Token:char(8),pTo_Datetime-"8:00:00",122)
Line Number: 1.SQL语句如下:
Select convert(char(8),pTo_Datetime-"8:00:00",112) as WorkDate,
processorID,
(select OpName from operator b where a.processorid = b.opid) as processorname,
worknode = case workflow_node
when "1" then "11"
when "2" then "22"
when "3" then "33"
when "4" then "44"
when "5" then "55"
end,
count(workflow_node) as SHULIANG from job_log a
where process_status = "2"
and convert(char(8),pTo_Datetime-"8:00:00",112) >= "20021006"
and convert(char(8),pTo_Datetime-"8:00:00",112) <= "20021016"
group by convert(char(8),pTo_Datetime-"8:00:00",112),
processorID,workflow_node order by workdate desc,processorID
在线等待,谢谢大侠
在Query中,':'后面代表的是参数。
在Query.SQL中,不能有多余的冒号。
其他都没有问题,谢谢各位
其他都没有问题,谢谢各位
可能是在QUERY中 convert(char(8),pTo_Datetime-"8:00:00",112) 的写法错误,不清楚你是怎样写的???能把你在TQUERY中的代码写出来看看,