码迷,mamicode.com
首页 > 数据库 > 详细

laravel调用sql server存储过程

时间:2017-08-09 19:14:02      阅读:438      评论:0      收藏:0      [点我收藏+]

标签:get   odi   sql   test   dai   @age   modify   bind   hal   

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存储过程

标签:get   odi   sql   test   dai   @age   modify   bind   hal   

原文地址:http://www.cnblogs.com/yuanxiaoping_21cn_com/p/7326987.html

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