当前位置:网站首页>Detailed explanation of SQL stored procedures
Detailed explanation of SQL stored procedures
2022-07-31 10:18:00 【xiaoweiwei99】
1. Concept of stored procedure
Stored procedure: A collection of one or more SQL statements that have been precompiled into an executable procedure.
2. Syntax for creating stored procedures
create procedure proc_name
[
{@parameter datatype}[=default][output],
{@parameter datatype} [=default] [output]
]
as
SQL_statements
3. Delete the stored procedure:
if (exists(select * from sysobjects where name='proc_name')){
drop proc_name
}
4. Create a stored procedure:
create procedure proc_name
as
begin
select * from 《Table Name》
end
5. Call the stored procedure
exec proc_name
6. Advantages and disadvantages of stored procedures
Advantages: Improve performance, reduce network overhead, facilitate code porting, and have stronger security
Disadvantages: He needs specialized database developers to maintain, design logic changes, and modify stored procedures without sql flexibility
7. Common system stored procedures
exec sp_databases to view databases
exec sp_tables to view tables
exec sp_columns "table name" to view the columns of the data table
exec sp_stored_procedures to view stored procedures
Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
猜你喜欢
随机推荐
C#之泛型、委托、事件及其使用
loadrunner-Controller负载测试-各模块功能记录01测试场景设计
Burndown chart of project management tools: Dynamic assessment of team work ability
前序、后序及层次遍历实现二叉树的序列化与反序列化
The fifth chapter
Centos7 install mysql5.7
What is the encoding that starts with ?
loadrunner-controller-view script与load generator
VMware下安装win10
Meikle Studio--Hongmeng 14-day development training notes (8)
【LeetCode】387. 字符串中的第一个唯一字符
KVM虚拟化作业
GZIPInputStream 类源码分析
金鱼哥RHCA回忆录:CL210管理OPENSTACK网络--开放虚拟网络(OVN)简介(课后练习)
使用turtle画按钮
loadrunner-controller-场景执行run
【LeetCode】1161.最大层内元素和
loadrunner脚本--添加检查点
通过栗子来学习MySQL高级知识点(学习,复习,面试都可)
NowCoderTOP28-34二叉树——持续更新ing









