use StudentManager
go
if exists(select * from sysobjects where name='usp_ScoreQuery2')
drop procedure usp_ScoreQuery2
go
--创建带参数的存储过程
create procedure usp_ScoreQuery2
@CSharp int,
@DB int
as
select Students.StudentId,StudentName,C#=CSharp,DB=SQLServerDB
from Students
inner join ScoreList on Students.StudentId=ScoreList.StudentId
where CSharp<@CSharp or SQLServerDB<@DB
go
--调用带参数的存储过程
exec usp_ScoreQuery2 60,65 --按照参数顺序赋值
exec usp_ScoreQuery2 @DB=65,@CSharp=60 --参数顺序可以调换

为参数赋默认值

 use StudentManager
go
if exists(select * from sysobjects where name='usp_ScoreQuery3')
drop procedure usp_ScoreQuery3
go
--创建带参数的存储过程
create procedure usp_ScoreQuery3
@CSharp int=60,
@DB int=60
as
select Students.StudentId,StudentName,C#=CSharp,DB=SQLServerDB
from Students
inner join ScoreList on Students.StudentId=ScoreList.StudentId
where CSharp<@CSharp or SQLServerDB<@DB
go
--调用带参数的存储过程
exec usp_ScoreQuery3 65 --第二个参数没有赋值,则默认
exec usp_ScoreQuery3 @DB=65
exec usp_ScoreQuery3 default,65 --不使用显示方式赋值
exec usp_ScoreQuery3 --两个参数都是用默认参数

最新文章

  1. c++第一天
  2. Java中的闪光点:ThreadLocal是线程Thead的局部变量,可替代同步机制的设计,值得学习和研究
  3. 改造 ThinkPHP,弃用 D() 等魔术函数
  4. SQL笔记 [长期更新] (-2015.4)
  5. php连接redis数据库 操作redis任务队列
  6. ```````````````辐射度 Radiometry
  7. 转载:PHP,MySQL的安装与配置
  8. JS异步加载的三种方式
  9. (菜鸟要飞系列)三,基于Asp.Net MVC5的后台管理系统(用户的增删改查功能)
  10. Transact-SQL 常用函数 分类: SQL Server 2015-02-03 09:47 284人阅读 评论(0) 收藏
  11. RDLC 聚合函数按条件求和,显示&quot;错误号&quot;
  12. 《JAVA与模式》之简单工厂模式
  13. python中对象、类型和元类之间的关系
  14. Python学习笔记(二):字典
  15. (四十九)Quartz2D自定义控件
  16. 嵌入式Linux内核tasklet机制(附实测代码)
  17. 转载:Systemd 服务配置文件
  18. bootstrap3中模态框的数据编辑使用方法
  19. (部署)使用kubernetes的deployment进行RollingUpdate
  20. January 02 2017 Week 1st Monday

热门文章

  1. centos 7 lvs 负载均衡搭建部署
  2. linux常见系统调用函数列表
  3. gdb入门
  4. django用mysql数据库出现的问题解决
  5. PyCharm中的Console自动换行
  6. eclipse中如何去掉复制代码有行号的数字
  7. 有10 亿个 url,每个 url 大小小于 56B,要求去重,内存只给你4G
  8. LB+nginx+tomcat7集群模式下的https请求重定向(redirect)后变成http的解决方案
  9. (转)oms系统安装php的redis扩展
  10. dragino2 ar9331将LED管脚当做普通gpio使用