当前位置:网站首页>Bi-sql stored procedure (I)
Bi-sql stored procedure (I)
2022-06-25 23:33:00 【Powerbi white tea】
stored procedure ( One )
stored procedure , Can be said to be SQL The more important concept in , Basically, all data projects will involve this content .
Many interviews take place in the second round of technical interviews , It will also be mentioned , So what are stored procedures ?
Definition
Stored procedures are similar to C Functions in language
It can usually be used to perform administrative tasks or apply complex rules
Stored procedures can take parameters , You can also return the result directly
Stored procedures can contain data manipulation statements 、 Variable 、 Logic control statements, etc
White tea recently talked about stored procedures with her development partners , That's what he said :
stored procedure , You can think of it as a data set .
Can be called by an internal trigger , Can be called by external programs , It can also be called by other stored procedures .
grammar
SQL Server grammar :
CREATE PROCEDURE Stored procedure name
@PARAMETER Parameter type
......
AS
BEGIN
Procedure statement
END
Call stored procedure statement :
EXECUTE Process name
Using examples
Case data :
In the database of white tea machine, there is a database named “CaseData” The database of .
“Dim_Date“ Date sheet 、"Dim_Product" Product list 、"Fact_Sales" Sales fact sheet .
Example 1:
Create a TEST1 Stored procedure , The product name in the filtered products table is “ sunglasses ” The data of .
CREATE PROCEDURE TEST1
AS
BEGIN
SELECT * FROM Dim_Product WHERE ProductName=' sunglasses '
END
give the result as follows :
Let's try calling this stored procedure to see the result :
EXECUTE TEST1
give the result as follows :
Example 2:
Create a TEST2 Stored procedure , Store all data in the product table , And add parameters , So that subsequent conditional calls can be made .
CREATE PROCEDURE TEST2
@Product VARCHAR(20)
AS
BEGIN
SELECT * FROM Dim_Product WHERE [email protected]
END
give the result as follows :
The input name is “ masks ‘ Conditions , Let's call TEST2 stored procedure .
In terms of results , In line with our expectations .
actually , Stored procedures have a lot more , White tea is not introduced in detail , For example, what are the benefits of stored procedures , For example, the use of stored procedures to add loops , The usage of adding cursors to stored procedures, etc .
Later, white tea will be added slowly , There are some inaccuracies in the article , Please forgive me , White tea is also in the stage of just learning .
Take dreams as horses , Not to lose time , May we learn together , Common progress .
This is white tea , One PowerBI Beginners .
边栏推荐
- CAD中图纸比较功能怎么用
- golang Make a list of intervals with sequential numbers
- 关于go中资源泄漏/goroutine泄漏/内存泄漏/CPU打满等情况分析
- [Axi] interpretation of Axi protocol disorder mechanism
- [opencv450 samples] create image list yaml
- CTS RTS RX TX in serial port flow control UART (direct communication between serial port module and MCU)
- Beacon realizes asset management and indoor positioning based on 5.2 ultra-low power Bluetooth module efr32 (bg22ax)
- C2. k-LCM (hard version)-Codeforces Round #708 (Div. 2)
- Circuit module analysis exercise 6 (switch)
- Fegin client entry test
猜你喜欢
LM small programmable controller software (based on CoDeSys) note XVII: PTO pulse function block
Idea auto generator generates constructor get/set methods, etc
Live800在线客服系统:跨越时空做生意,从每次互动开始
提取系统apk
二进制、16进制、大端小端
Why is the frame rate calculated by opencv wrong?
Use of xinchida ble 5.0 Low Power Bluetooth module (at command serial port transparent transmission) rsbrs02abr
转载: QTableWidget详解(样式、右键菜单、表头塌陷、多选等)
CAD中图纸比较功能怎么用
24class static member
随机推荐
My C language learning process
#23class介绍
Idea auto generator generates constructor get/set methods, etc
Circuit module analysis exercise 5 (power supply)
【opencv450 samples】创建图像列表yaml
Ad20 learning notes I
golang Make a list of intervals with sequential numbers
UE4 学习记录一 创建角色,并控制其移动
What is Unified Extensible Firmware Interface (UEFI)?
Qt Utf8 与 Unicode 编码的互相转换, Unicode编码输出为格式为 &#xXXXX
[opencv450 samples] create image list yaml
漏刻有时API接口实战开发系列(13):小鹅通云服务PHP-API二维数组传参解决方案
To solve the incompatibility between VM and device/credential guard, an effective solution for the whole network
#24class静态成员
MySQL queries data by day, week, month, quarter and year
cookie、session、token
ACM. HJ16 购物单 ●●
[untitled] open an item connection. If it cannot be displayed normally, Ping the IP address
毕业旅行 | 伦敦5日游行程推荐
BI-SQL丨存储过程(一)