sqlexec()老是等于-1
下面的代码,第一次运行的时候,都ok的结果集表CallRecord也Browse成功了
之后没释放这个远程表CallRecord
再运行这段代码的时候,SQLCONNECT都>0的,但是sqlexec()老是-1
是不是没释放这个远程表CallRecord的关系啊
CLEAR
CLEAR ALL
SET DATE TO ANSI
SET CENTURY ON
HeadDate=CTOD("20160111")
TailDate=CTOD("20160116")
myConnHandle=SQLCONNECT('KeFuTel','sa','Aa12345')
?myConnHandle
? SQLEXEC(myConnHandle,;
"select EmployeeNumber as 客服工号,count(distinct Caller) as 联系客户数,count(*) as 呼出总数,;
sum(datediff(ss,TallTimeStart,TallTimeEnd)) as 通话时长,;
sum(case when datediff(ss,TallTimeStart,TallTimeEnd)=0 and flag<>1 then 1 else 0 end) as 未接通数,"+;
"sum(case when flag=1 then 1 else 0 end) as 已接通数,;
sum(case when datediff(ss,TallTimeStart,TallTimeEnd)=0 and flag=1 then 1 else 0 end) as 接通0S以上;
from AiLink.dbo.Thing_CallPhone "+ ;
"where convert(varchar(10),TallTimeStart,110)>=cast(HeadDate as date) and;
convert(varchar(10),TallTimeStart,110)<=cast(TailDate as date) and TallWay=1 and"+;
" EmployeeNumber in('8010','8013','8011','8035','8036','8034','8037','8020','8027','8021','8032','8038','8051','8018','8052','8030','8022','8028');
group by EmployeeNumber order by EmployeeNumber",;
"CallRecord")
BROWSE
SQLDISCONNECT(myConnHandle)