当前位置:网站首页>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 .
边栏推荐
- 分享一个OSGeo4W64下载好的库,基于qgis3.10的
- [opencv450 samples] inpaint restores the selected region in the image using the region neighborhood
- What aspects should we start with in the feasibility analysis of dry goods?
- Implementation of importing vscode from PDM
- User interaction scanner usage Advanced Edition example
- leetcode_ 136_ A number that appears only once
- Set up your own website (15)
- Efr32bg22 ble module (low power Bluetooth communication module) at command test
- 指针强化与提高
- Hbuilderx uses the gaude map to obtain the current location
猜你喜欢

24class static member

UE4\UE5 蓝图节点Delay与Retriggerable Delay的使用与区别
![[untitled] open an item connection. If it cannot be displayed normally, Ping the IP address](/img/34/d3c146d5faa2728cb5eb8f3ee00200.png)
[untitled] open an item connection. If it cannot be displayed normally, Ping the IP address

Qt 中文和英文分别使用不同的字体

leetcode_ 136_ A number that appears only once

Problem recording and thinking

My vscode

Several optimization scenarios using like fuzzy retrieval in SQL

二进制、16进制、大端小端

ACM. HJ16 购物单 ●●
随机推荐
hiberate实体类CURD、事务操作汇总
【无标题】打开一个项目连接,无法正常显示时,ping一下ip
Idea common plug-ins
Beacon realizes asset management and indoor positioning based on 5.2 ultra-low power Bluetooth module efr32 (bg22ax)
[modulebuilder] GP service realizes the intersection selection of two layers in SDE
分享一个OSGeo4W64下载好的库,基于qgis3.10的
When are the three tools used for interface testing?
Applets - view and logic
信息学奥赛一本通 1353:表达式括号匹配(stack) | 洛谷 P1739 表达式括号匹配
Multithreaded learning 1
Efr32bg22 ble module (low power Bluetooth communication module) at command test
[opencv450 samples] inpaint restores the selected region in the image using the region neighborhood
二进制、16进制、大端小端
我的vscode
Informatics Orsay all in one 1353: expression bracket matching | Luogu p1739 expression bracket matching
【2023校招刷题】番外篇1:度量科技FPGA岗(大致解析版)
Kubernetes cluster construction of multiple ECS
UE4_UE5结合offline voice recognition插件做语音识别功能
String对象(常量)池
Leetcode (605) -- flower planting