您现在的位置是:网站首页> 编程资料编程资料
Sql中存储过程的定义、修改和删除操作_MsSql_
2023-05-26
368人已围观
简介 Sql中存储过程的定义、修改和删除操作_MsSql_
1.存储过程的分类
- 系统存储过程
- 本地存储过程(用户自定义)
- 临时存储过程(局部【#】、全局【##】临时存储过程)
2.创建存储过程
--选出价格区间的商品信息 create procedure sp_goods_price @minprice float ,@maxprice float as select * from goods where price>=@minprice and price <=@maxprice go
执行存储过程: execute sp_goods_price 200 2000
3.修改存储过程
create procedure sp_goods_betw @minprice float =200,@maxprice float=3000 as select * from goods where price>=@minprice and price <=@maxprice go
4.删除存储过程
drop procedure sp_goods_price
5.查看存储过程
sp_helptext procedureName sp_help procedureName
6.重命名存储过程
exec sp_rename oldName newName
**局部存储过程
create procedure #sp_goods_betw @minprice float ,@maxprice float as select * from goods where price>=@minprice and price <=@maxprice go
**全局存储过程
create procedure ##sp_goods_betw @minprice float ,@maxprice float as select * from goods where price>=@minprice and price <=@maxprice go
**不加缓存的存储过程
create procedure sp_goods_betw @minprice float ,@maxprice float with recompile as select * from goods where price>=@minprice and price <=@maxprice go
**加密存储过程
create procedure sp_goods_betw @minprice float ,@maxprice float with enctyption as select * from goods where price>=@minprice and price <=@maxprice go
总结
以上所述是小编给大家介绍的Sql中存储过程的定义、修改和删除,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
相关内容
- sql存储过程实例--动态根据表数据复制一个表的数据到另一个表_MsSql_
- sql server建表时设置ID字段自增的简单方法_MsSql_
- PL/SQL Developer过期的两种解决方法_MsSql_
- SQL Server三种锁定模式的知识讲解_MsSql_
- SQL Server视图的讲解_MsSql_
- Sql Server的一些知识点定义总结_MsSql_
- SQL Server中的SELECT会阻塞SELECT吗_MsSql_
- 小米正式开源 SQL 智能优化与改写工具 SOAR_MsSql_
- SQL Server 数据库调整表中列的顺序操作方法及遇到问题_MsSql_
- sql server2008调试存储过程的完整步骤_MsSql_
