php调用使用链接服务器的mssql存储过程出错,哪位有遇过到类似的问题?
//省略其它语句
$queryP= "exec OA_pfm_attend_group_toExempt @begin='$DATE1',@end='$DATE2'";
$cursor = msexequery( $msconnection, $queryP );
//省略其它语句
//组合的$queryP是:exec OA_pfm_attend_group_toExempt @begin='2013-03-01',@end='2013-03-24'
存储过程在查询分析器执行没有问题,把所有使用链接服务器的语句删除后php调用也没有问题,是不是php调用的存储过程不能使用链接服务器?我写个asp试试有问题没[经过测试,存储过程在asp下执行也没有任何问]
php的出错信息无参考价值:
错误#0:
SQL语句: exec OA_pfm_attend_group_toExempt @begin='2013-03-01',@end='2013-03-24'
sqlserver事件跟踪和日志信息查不到有用的信息.
存储过程代码:
drop proc OA_pfm_attend_group_toExemptgoCreate proc OA_pfm_attend_group_toExempt@begin datetime,@end datetimeasbegin set nocount on set ANSI_WARNINGS on set ANSI_NULLS on --declare @begin datetime --declare @end datetime --set @begin = @beginSTR --set @end = @endSTR create table #query_Table_Temp ( checkDay datetime not null ,checkIn datetime not null ,checkOut datetime not null ,isHoliday bit not null default 0 ) declare @checkDay datetime declare @checkIn datetime declare @checkOut datetime set @checkDay = @begin while (@checkDay<=@end) begin set @checkIn = convert(varchar(10),@checkDay)+' 08:35:00' set @checkOut = convert(varchar(10),@checkDay)+' 18:30:00' insert into #query_Table_Temp (checkDay,checkIn,checkOut) values(@checkDay,@checkIn,@checkOut) --update #query_Table_Temp set isHoliday=1 where checkDay in (select Holiday from OPENQUERY(OAMySQL, 'SELECT * from a_rest_holiday')) set @checkDay = dateadd(day,1,@checkDay) end delete from #query_Table_Temp where checkDay in (select Holiday from OPENQUERY(OAMySQL, 'SELECT * from a_rest_holiday'))--这句引起出错,把这些调用链接服务器的所有语句删除就举出错 create table #attend_Temp( checkDay datetime not null ,userID int ,Name varchar(30) ,User_ID varchar(30) ,dept_ID int ,defCheckIn datetime ,defCheckOut datetime ,checkIn datetime null ,checkOut datetime null ,rest bit not null default 0 ,leave1 bit not null default 0 ,leave2 bit not null default 0 ,out1 bit not null default 0 ,out2 bit not null default 0 ,evection bit not null default 0 ) insert #attend_Temp (checkDay,userID,Name,User_ID,dept_ID,defCheckIn,defCheckOut) select a.checkDay,b.UserID,b.Name,b.oa_UserID,b.defaultDeptID,a.checkIn,a.checkOut from #query_Table_Temp a join FileServiceDB.dbo.UserInfo b on 1=1 where b.Active=1 and b.checkFree=0 --select a.checkDay,a.checkIn,a.checkOut,b.UserID,b.Name,b.defaultDeptID,b.oa_UserID from #query_Table_Temp a join FileServiceDB.dbo.UserInfo b on 1=1 where b.Active=1 and b.checkFree=0 update #attend_Temp set checkIn=(select min(checkTime) from OA_checkInOut where userID=#attend_Temp.userID and datediff(minute,checkTime,#attend_Temp.defCheckIn) between -150 and 210) update #attend_Temp set checkOut=(select max(checkTime) from OA_checkInOut where userID=#attend_Temp.userID and datediff(minute,#attend_Temp.defCheckOut,checkTime) between -270 and 690) --其它语句 select checkDay,(select count(*) from #attend_Temp where checkDay=#query_Table_Temp.checkDay and checkIn>#query_Table_Temp.checkIn and out1=0 and leave1=0 and rest=0 and evection=0) as 迟到人次 ,(select count(*) from #attend_Temp where checkDay=#query_Table_Temp.checkDay and checkOut<#query_Table_Temp.checkOut and out2=0 and leave2=0 and rest=0 and evection=0) as 早退人次 ,(select count(*) from #attend_Temp where checkDay=#query_Table_Temp.checkDay and checkIn is null and out1=0 and leave1=0 and rest=0 and evection=0) as 上班未登记人次 ,(select count(*) from #attend_Temp where checkDay=#query_Table_Temp.checkDay and checkOut is null and out2=0 and leave2=0 and rest=0 and evection=0) as 下班未登记人次 from #query_Table_Temp drop table #query_Table_Temp drop table #attend_Temp set nocount offendGO
回复讨论(解决方案)
msexequery 是 php 函数吗?
我怎么没见过
哦,真是奇了,原来是用mssql_query不行,改为odbc_exec没问题了.先用着odbc_exec先.
msexequery是包装的函数,原来用的是mssql_query.

Laravel使用其直观的闪存方法简化了处理临时会话数据。这非常适合在您的应用程序中显示简短的消息,警报或通知。 默认情况下,数据仅针对后续请求: $请求 -

PHP客户端URL(curl)扩展是开发人员的强大工具,可以与远程服务器和REST API无缝交互。通过利用Libcurl(备受尊敬的多协议文件传输库),PHP curl促进了有效的执行

Laravel 提供简洁的 HTTP 响应模拟语法,简化了 HTTP 交互测试。这种方法显着减少了代码冗余,同时使您的测试模拟更直观。 基本实现提供了多种响应类型快捷方式: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

PHP日志记录对于监视和调试Web应用程序以及捕获关键事件,错误和运行时行为至关重要。它为系统性能提供了宝贵的见解,有助于识别问题并支持更快的故障排除

您是否想为客户最紧迫的问题提供实时的即时解决方案? 实时聊天使您可以与客户进行实时对话,并立即解决他们的问题。它允许您为您的自定义提供更快的服务

文章讨论了PHP 5.3中引入的PHP中的晚期静态结合(LSB),从而允许静态方法的运行时分辨率调用以获得更灵活的继承。 LSB的实用应用和潜在的触摸


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

螳螂BT
Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

SublimeText3 英文版
推荐:为Win版本,支持代码提示!

禅工作室 13.0.1
功能强大的PHP集成开发环境