首页 > 健康养生

调试存储过程(sqlserver调试存储过程)

健康养生 2023-08-31 21:16:01
生活中,有很多朋友觉得调试存储过程(sqlserver调试存储过程)很难弄明白,那么我们到底要如何解决这个问题呢,今天小编就带来大家看看,希望可以帮助各位。

调试存储过程(sqlserver调试存储过程)

调试存储过程(sqlserver调试存储过程)

-创建一个存储过程(无参数)

创建过程sp_pro1

select count(*)from student;

-调用存储过程

调用sp _ pro1

-创建带参数的存储过程

-输入参数

创建过程sp_pro2(typeid int)

开始

如果typeid=1,则

select * from score where cid = ' 01 ' order by mark desc limit 0,3;

那么elseif typeid=2

select * from score where cid = ' 02 ' order by mark desc limit 0,3;

结束if;

结束;

调用sp _ pro2(1);

-输出参数

create procedure sp _ pro3(typeid int,out mycount int)

开始

如果typeid=1,则

select count(*)into my count from score where cid = ' 01 ' and mark & gt;90;

那么elseif typeid=2

select count(*)into my count from score where cid = ' 02 ' and mark & gt;90;

结束if;

结束;

-调用带有输出参数的存储过程时,在输出参数前添加@。

调用sp_pro3(1,@ my count);

选择@ mycount


标签: 过程

生活百科 饮食百科 健康养生 美容减肥 自然百科 科普大全 文化常识
Copyright 百科网 备案号:冀ICP备2022029337号-3本站图文信息均来自于网络收集,仅供大家参考,不作为医疗诊断依据。
统计代码