存储过程基础知识汇总
2017-08-31 21:18
363 查看
--查询所有存储过程 select * from sys.objects where type = 'P';
--修改存储过程 alter proc proc_get_student as select * from student;
--调用、执行存储过程 exec proc_get_student;
--------------------------------
--创建存储过程 if (exists (select * from sys.objects where name = 'proc_get_student')) drop proc proc_get_student go create proc proc_get_student as select * from student;
-----------------------------------
--带参存储过程 if (object_id('proc_find_stu', 'P') is not null) drop proc proc_find_stu go create proc proc_find_stu(@startId int, @endId int) as select * from student where id between @startId and @endId go exec proc_find_stu 2, 4;
-------------------------------------
--带通配符参数存储过程 if (object_id('proc_findStudentByName', 'P') is not null) drop proc proc_findStudentByName go create proc proc_findStudentByName(@name varchar(20) = '%j%', @nextName varchar(20) = '%') as select * from student where name like @name and name like @nextName; go exec proc_findStudentByName; exec proc_findStudentByName '%o%', 't%';
相关文章推荐
- SQL server存储过程基础知识
- SQL Server之存储过程基础知识
- SQL使用数据库引擎存储过程,系统视图查询,DBA,BI开发人员必备基础知识
- 存储过程相关知识 汇总
- 教学思路SQL之入门习题《学生成绩》 七.存储过程基础知识
- Mysql基础知识:存储过程和函数
- 存储过程基础知识
- sql server 存储过程基础知识
- SQL Server之存储过程基础知识
- MYSQL 存储过程1、SQL存储过程的基础知识
- SQL点滴17—使用数据库引擎存储过程,系统视图查询,DBA,BI开发人员必备基础知识
- MySql存储过程—1、SQL存储过程的基础知识
- 存储过程基础知识
- MySql存储过程—1、SQL存储过程的基础知识
- MySql存储过程—1、SQL存储过程的基础知识
- sqlsever 浅析存储过程 存储过程基础知识
- 存储过程基础知识
- SQL Server之存储过程基础知识
- 关于SQL 存储过程入门基础(基础知识)
- 关于SQL 存储过程入门基础(基础知识)