TP5执行存储过程报The active result for the query contains no fields.
创建SqlServer存储过程
create procedure INSERT_USERINFO
@NAME varchar(16)
AS
BEGIN
--指定插入标识符的显式值
set IDENTITY_INSERT USERINFO ON
insert into USERINFO(USERID,NAME,BADGENUMBER) select USERID,NAME,BADGENUMBER from USERINFO_BEI where NAME=@NAME
set IDENTITY_INSERT USERINFO OFF
END
php执行上面存储过程报错
$pro = "exec INSERT_USERINFO " . $value['realname']; $codeu = $db->query($pro);
修改存储过程
create procedure INSERT_USERINFO
@NAME varchar(16)
AS
BEGIN
set nocount on
set IDENTITY_INSERT USERINFO ON
insert into USERINFO(USERID,NAME,BADGENUMBER) select USERID,NAME,BADGENUMBER from USERINFO_BEI where NAME=@NAME
set IDENTITY_INSERT USERINFO OFF
SELECT 1
END
$pro = "exec INSERT_USERINFO " . $value['realname']; $codeu = $db->query($pro); //返回1
OK