調用使用連結的伺服器的mssql預存程序遇到的有關問題

來源:互聯網
上載者:User
調用使用連結的伺服器的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事件跟蹤和日誌資訊查不到有用的資訊.

預存程序代碼:

drop proc OA_pfm_attend_group_toExempt
go
Create proc OA_pfm_attend_group_toExempt
@begin datetime,
@end datetime
as
begin
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<[email protected]) 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
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.