当前位置:网站首页>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
边栏推荐
猜你喜欢
Redis Sentinel原理
darknet 源码阅读笔记-01-activation_kernels.cu
NowCoderTOP17-22 Binary search/sort - continuous update ing
Android安全专题(三)JNI混淆
NowCoderTOP28-34 binary tree - continuous update ing
学习笔记——七周成为数据分析师《第二周:业务》:业务分析框架
如何在 TiDB Cloud 上使用 Databricks 进行数据分析 | TiDB Cloud 使用指南
Sql优化总结!详细!(2021最新面试必问)
Redis Cluster - Sentinel Mode Principle (Sentinel)
loadrunner脚本--添加检查点
随机推荐
数据中台建设(六):数据体系建设
Chapter VII
医院管理系统数据库,课程设计,SQLserver,纯代码设计
DC-7-vulnhub
Module eight
【LeetCode】383.赎金信
浅谈Attention与Self-Attention,一起感受注意力之美
csdn file export to pdf
csdn文件导出为pdf
因存在自燃安全隐患,宝马7系和5系紧急召回,合计超过5.7万辆
通过栗子来学习MySQL高级知识点(学习,复习,面试都可)
自定义v-drag指令(横向拖拽滚动)
Web系统常见安全漏洞介绍及解决方案-sql注入
NowCoderTOP23-27二叉树遍历——持续更新ing
Rich text editor Tinymce
Redis Sentinel原理
KVM虚拟化作业
Meikle Studio--Hongmeng 14-day development training notes (8)
LeetCode二叉树系列——101.对称二叉树
SQLSERVER将子查询数据合并拼接成一个字段