首页 > 代码库 > laravel调用sql server存储过程
laravel调用sql server存储过程
alter proc [dbo].[aaa]
(
@AgencyID int,--代理商ID
@AdminID int --结算操作人ID(管理员ID)
)
as
begin
select top 5 * from tusers
return 5
end
$dbh = DB::connection()->getPdo();
$stmt = $dbh->prepare("EXEC aaa ?,?");//Web_pAgencyBalance_Single
$a = 1;
$b = 2;
$stmt->bindParam(1, $a, \PDO::PARAM_INT);
$stmt->bindParam(2, $b, \PDO::PARAM_INT);
$stmt->execute();
$s = $stmt->fetchAll(\PDO::FETCH_ASSOC);
//$s = $stmt->query("select @r");//->fetchAll(\PDO::FETCH_ASSOC);
print_r($c);
print_r($s);
结果
-------------------------------------------------------------------------------
0Array ( [0] => Array ( [UserID] => 7518 [UserName] => 12345678544 [Pass] => 4297f44b13955235245b2497399d7a93 [TwoPassword] => 4297f44b13955235245b2497399d7a93 [NickName] => 121123 [LogoID] => 0 [LogoFileMD5] => [Token] => [OnlineFlag] => 0 [Disabled] => 0 [Sex] => 0 [IsRobot] => 0 [AgencyID] => 1 [AgencyName] => admin [Salt] => [IsModifyTwoPassword] => 0 [BindAlipay] => [BindAlipayName] => [IsBindAlipay] => 0 ) [1] => Array ( [UserID] => 34946 [UserName] => 15618478590 [Pass] => d41d8cd98f00b204e9800998ecf8427e [TwoPassword] => d41d8cd98f00b204e9800998ecf8427e [NickName] => test111 [LogoID] => 0 [LogoFileMD5] => [Token] => [OnlineFlag] => 0 [Disabled] => 0 [Sex] => 0 [IsRobot] => 0 [AgencyID] => 1 [AgencyName] => admin [Salt] => [IsModifyTwoPassword] => 0 [BindAlipay] => [BindAlipayName] => [IsBindAlipay] => 0 ) [2] => Array ( [UserID] => 43016 [UserName] => 43016 [Pass] => 972dd7e894fe7fbc5844bc66d02e66c3 [TwoPassword] => 972dd7e894fe7fbc5844bc66d02e66c3 [NickName] => 43016 [LogoID] => 0 [LogoFileMD5] => [Token] => [OnlineFlag] => 0 [Disabled] => 0 [Sex] => 0 [IsRobot] => 0 [AgencyID] => 0 [AgencyName] => daili0001 [Salt] => [IsModifyTwoPassword] => 0 [BindAlipay] => [BindAlipayName] => [IsBindAlipay] => 0 ) [3] => Array ( [UserID] => 51894 [UserName] => 13061767771 [Pass] => 3333333 [TwoPassword] => 3333333 [NickName] => Reese‘s [LogoID] => 0 [LogoFileMD5] => [Token] => [OnlineFlag] => 0 [Disabled] => 0 [Sex] => 0 [IsRobot] => 0 [AgencyID] => 1 [AgencyName] => admin [Salt] => [IsModifyTwoPassword] => 1 [BindAlipay] => [BindAlipayName] => [IsBindAlipay] => 0 ) [4] => Array ( [UserID] => 53492 [UserName] => 53492 [Pass] => f7ad15746f953382379000261beba6a0 [TwoPassword] => f7ad15746f953382379000261beba6a0 [NickName] => 53492 [LogoID] => 0 [LogoFileMD5] => [Token] => [OnlineFlag] => 0 [Disabled] => 0 [Sex] => 0 [IsRobot] => 0 [AgencyID] => 0 [AgencyName] => daili0001 [Salt] => [IsModifyTwoPassword] => 0 [BindAlipay] => [BindAlipayName] => [IsBindAlipay] => 0 ) )
laravel调用sql server存储过程
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。