sqlserver存儲過程及mybatis調用——待續


創建帶輸入參數存儲過程

use yanantest
go
if exists (select * from sys.objects where name='yanan')
drop procedure yanan
go
create proc  yanan(@name varchar(2))
as
select * from student where name=@name;

go

exec yanan 'zs';

 

創建帶輸入參數存儲過程 

 

if exists(select * from sys.objects where name='yanan2')
drop proc yanan2
go
create proc yanan2 (@name varchar(2),@age int output)
as
begin
select @age=age from student where name=@name;
end
go
declare @age int
exec yanan2 'ls', @age output
select @age

 

mybatis調用:

<select id="getUsers" resultType="User">
exec yanan_getUsers 'zs';
</select>

 

 

20180810:查看另一篇更詳細的博客

https://www.cnblogs.com/yanan7890/p/8776379.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM