码迷,mamicode.com
首页 > 其他好文 > 详细

TP5执行存储过程报The active result for the query contains no fields.

时间:2018-05-12 11:17:27      阅读:1025      评论:0      收藏:0      [点我收藏+]

标签:ADG   sqlserver   query   begin   AC   into   use   arch   HERE   

创建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

 

TP5执行存储过程报The active result for the query contains no fields.

标签:ADG   sqlserver   query   begin   AC   into   use   arch   HERE   

原文地址:https://www.cnblogs.com/yixing/p/9027866.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!