Home Backend Development PHP Tutorial 调用使用链接服务器的mssql存储过程遇到的有关问题

调用使用链接服务器的mssql存储过程遇到的有关问题

Jun 13, 2016 am 11:18 AM
datetime nbsp null

调用使用链接服务器的mssql存储过程遇到的问题

本帖最后由 ycliaojy 于 2013-03-24 20:40:29 编辑   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事件跟踪和日志信息查不到有用的信息.

存储过程代码:
<br>drop proc OA_pfm_attend_group_toExempt<br>go<br>Create proc OA_pfm_attend_group_toExempt<br>@begin datetime,<br>@end datetime<br>as<br>begin<br>  set nocount on<br>  set ANSI_WARNINGS on<br>  set ANSI_NULLS on<br>  --declare @begin datetime<br>  --declare @end datetime<br>  --set @begin = @beginSTR<br>  --set @end   = @endSTR<br>  create table #query_Table_Temp (<br>    checkDay datetime not null<br>   ,checkIn  datetime not null<br>   ,checkOut datetime not null<br>   ,isHoliday bit not null default 0<br>  )<br>  declare @checkDay datetime<br>  declare @checkIn datetime<br>  declare @checkOut datetime<br>  set @checkDay = @begin<br>  while (@checkDay    set @checkIn  = convert(varchar(10),@checkDay)+' 08:35:00'<br>    set @checkOut = convert(varchar(10),@checkDay)+' 18:30:00'<br>    insert into #query_Table_Temp (checkDay,checkIn,checkOut) values(@checkDay,@checkIn,@checkOut)<br>    --update #query_Table_Temp set isHoliday=1 where checkDay in (select Holiday from OPENQUERY(OAMySQL, 'SELECT * from a_rest_holiday'))<br>    set @checkDay = dateadd(day,1,@checkDay)<br>  end<br>  delete from #query_Table_Temp where checkDay in (select Holiday from OPENQUERY(OAMySQL, 'SELECT * from a_rest_holiday'))--这句引起出错,把这些调用链接服务器的所有语句删除就举出错<br>  create table #attend_Temp(<br>   checkDay datetime not null<br>  ,userID int<br>  ,Name varchar(30)<br>  ,User_ID varchar(30)<br>  ,dept_ID int<br>  ,defCheckIn datetime<br>  ,defCheckOut datetime<br>  ,checkIn datetime null<br>  ,checkOut datetime null<br>  ,rest bit not null default 0<br>  ,leave1 bit not null default 0<br>  ,leave2 bit not null default 0<br>  ,out1 bit not null default 0<br>  ,out2 bit not null default 0<br>  ,evection bit not null default 0<br>  )<br>  insert #attend_Temp (checkDay,userID,Name,User_ID,dept_ID,defCheckIn,defCheckOut)<br>  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<div class="clear">
                 
              
              
        
            </div>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Solution: Your organization requires you to change your PIN Solution: Your organization requires you to change your PIN Oct 04, 2023 pm 05:45 PM

Solution: Your organization requires you to change your PIN

How to adjust window border settings on Windows 11: Change color and size How to adjust window border settings on Windows 11: Change color and size Sep 22, 2023 am 11:37 AM

How to adjust window border settings on Windows 11: Change color and size

How to change title bar color on Windows 11? How to change title bar color on Windows 11? Sep 14, 2023 pm 03:33 PM

How to change title bar color on Windows 11?

How to enable or disable taskbar thumbnail previews on Windows 11 How to enable or disable taskbar thumbnail previews on Windows 11 Sep 15, 2023 pm 03:57 PM

How to enable or disable taskbar thumbnail previews on Windows 11

OOBELANGUAGE Error Problems in Windows 11/10 Repair OOBELANGUAGE Error Problems in Windows 11/10 Repair Jul 16, 2023 pm 03:29 PM

OOBELANGUAGE Error Problems in Windows 11/10 Repair

Display scaling guide on Windows 11 Display scaling guide on Windows 11 Sep 19, 2023 pm 06:45 PM

Display scaling guide on Windows 11

10 Ways to Adjust Brightness on Windows 11 10 Ways to Adjust Brightness on Windows 11 Dec 18, 2023 pm 02:21 PM

10 Ways to Adjust Brightness on Windows 11

How to turn off private browsing authentication for iPhone in Safari? How to turn off private browsing authentication for iPhone in Safari? Nov 29, 2023 pm 11:21 PM

How to turn off private browsing authentication for iPhone in Safari?

See all articles