An error occurred while calling the mssql stored procedure on the linked server. This post was last edited by ycliaojy from 2013-03-2420: 40: 29. An error occurred while editing the mssql stored procedure using the linked server, which of the following has encountered a similar problem? Omitting other statements $ queryP & nbsp; exec & nbsp; OA_pfm_attend_group_toEx problems encountered when calling the mssql stored procedure using the linked server
This post was last edited by ycliaojy at 20:40:29
An error occurred while calling the mssql stored procedure using the linked server in php. Which of the following has encountered a similar problem?
// Omit other statements
$ QueryP = "exec OA_pfm_attend_group_toExempt @ begin = '$ DATE1', @ end = '$ date2 '";
$ Cursor = msexequery ($ msconnection, $ queryP );
// Omit other statements
// The combination of $ queryP is: exec OA_pfm_attend_group_toExempt @ begin = '2017-03-01 ', @ end = '2017-03-24'
There is no problem with the execution of the query analyzer in the stored procedure. after all the statements using the linked server are deleted, php call is no problem. Is it because the stored procedure called by php cannot use the linked server? I am trying to write an asp file. I have no problem. [after testing, the stored procedure is executed under asp without any questions.]
Php error information has no reference value:
Error #0:
SQL statement: exec OA_pfm_attend_group_toExempt @ begin = '2017-03-01 ', @ end = '2017-03-24'
Sqlserver event tracking and log information cannot find useful information.
Stored Procedure code:
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 <= @ 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 ') -- This sentence causes an error, if you delete all the statements that call the linked server, an error occurs.
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. checkDay, B. userID, B. name, B. oa_UserID, B. defaultDeptID,. checkIn,. checkOut from # query_Table_Temp a join FileServiceDB. dbo. userInfo B on 1 = 1 where B. active = 1 and B. checkFree = 0