调用使用链接服务器的mssql存储过程遇到的问题
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.

热AI工具

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

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

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

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

Dreamweaver CS6
视觉化网页开发工具

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

在PHP中,应使用password_hash和password_verify函数实现安全的密码哈希处理,不应使用MD5或SHA1。1)password_hash生成包含盐值的哈希,增强安全性。2)password_verify验证密码,通过比较哈希值确保安全。3)MD5和SHA1易受攻击且缺乏盐值,不适合现代密码安全。

PHP和Python各有优势,选择依据项目需求。1.PHP适合web开发,尤其快速开发和维护网站。2.Python适用于数据科学、机器学习和人工智能,语法简洁,适合初学者。

PHP在电子商务、内容管理系统和API开发中广泛应用。1)电子商务:用于购物车功能和支付处理。2)内容管理系统:用于动态内容生成和用户管理。3)API开发:用于RESTfulAPI开发和API安全性。通过性能优化和最佳实践,PHP应用的效率和可维护性得以提升。

PHP是一种广泛应用于服务器端的脚本语言,特别适合web开发。1.PHP可以嵌入HTML,处理HTTP请求和响应,支持多种数据库。2.PHP用于生成动态网页内容,处理表单数据,访问数据库等,具有强大的社区支持和开源资源。3.PHP是解释型语言,执行过程包括词法分析、语法分析、编译和执行。4.PHP可以与MySQL结合用于用户注册系统等高级应用。5.调试PHP时,可使用error_reporting()和var_dump()等函数。6.优化PHP代码可通过缓存机制、优化数据库查询和使用内置函数。7

PHP仍然具有活力,其在现代编程领域中依然占据重要地位。1)PHP的简单易学和强大社区支持使其在Web开发中广泛应用;2)其灵活性和稳定性使其在处理Web表单、数据库操作和文件处理等方面表现出色;3)PHP不断进化和优化,适用于初学者和经验丰富的开发者。

PHP类型提示提升代码质量和可读性。1)标量类型提示:自PHP7.0起,允许在函数参数中指定基本数据类型,如int、float等。2)返回类型提示:确保函数返回值类型的一致性。3)联合类型提示:自PHP8.0起,允许在函数参数或返回值中指定多个类型。4)可空类型提示:允许包含null值,处理可能返回空值的函数。

PHP和Python各有优劣,选择取决于项目需求和个人偏好。1.PHP适合快速开发和维护大型Web应用。2.Python在数据科学和机器学习领域占据主导地位。

PHP适合web开发,特别是在快速开发和处理动态内容方面表现出色,但不擅长数据科学和企业级应用。与Python相比,PHP在web开发中更具优势,但在数据科学领域不如Python;与Java相比,PHP在企业级应用中表现较差,但在web开发中更灵活;与JavaScript相比,PHP在后端开发中更简洁,但在前端开发中不如JavaScript。
