首页 > 数据库技术 > 详细

Sql Server存储过程详解

时间:2018-09-16 14:14:29      阅读:146      评论:0      收藏:0      [点我收藏+]

基本存储过程

if (exists (select * from sys.objects where name = GetUser)) drop proc GetUser   --判断存储过程是否存在,存在则删除然后重建。
go
create proc GetUser  --创建存储过程 GetUser
@Id int --参数
as 
set nocount on;  --不返回计数,提高应用程序性能
begin --开始
    select * from [dbo].[User] where Id=@Id  --执行sql语句
end;--结束

调用存储过程

EXEC GetUser 1;

执行结果

技术分享图片

Sql Server存储过程详解

原文:https://www.cnblogs.com/zj19940610/p/9655746.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!