当前位置:网站首页>Sql: stored procedures and triggers - Notes
Sql: stored procedures and triggers - Notes
2022-07-06 21:34:00 【Nianchi ichthyology programming】
1. Conceptual classification of variables
Concept : A language element assigned a certain value .
classification : Global variables 、 local variable
| Global variables | Variables provided by the system and declared in advance , Generally, users can only view and cannot modify the value of global variables , In general, it is based on @@ The starting variable |
|---|---|
| local variable | An object declared by a user to hold a single data value of a specific type . It is local to a statement batch , In general, it is based on @ The starting variable |
2. Declaration and assignment of variables
Local variables must be declared before use , Basic statement of declaration :
declare @ local variable [as] data type [,......n]
Be careful : Use declare The initial value of the local variable declared by the statement is initialized to NULL.
Variable assignment statement format :
set @ Local variable name = value | expression
Be careful : Any expression can be SQL expression
You can also use select Statement to assign a value to a local variable , The format is :
select @ local variable = value | expression
Example : Declare three integer variables :@x、@y and @z, And give @x、@y Each variable is assigned an initial value , Then assign the sum value of these two variables to @z, And display variables @z Result .
declare @x int , @y int , @z int
set @x = 10
set @y = 20
set @z = @x + @y
print @z
print The function of is to return user-defined information to the client , Its grammatical form is :
print 'ascll Text string ' | @ Local variable name | String expressions | @@ Function name
边栏推荐
- The use method of string is startwith () - start with XX, endswith () - end with XX, trim () - delete spaces at both ends
- JS operation DOM element (I) -- six ways to obtain DOM nodes
- HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
- Summary of cross partition scheme
- Study notes of grain Mall - phase I: Project Introduction
- 嵌入式开发的7大原罪
- In JS, string and array are converted to each other (I) -- the method of converting string into array
- 14 years Bachelor degree, transferred to software testing, salary 13.5k
- Nodejs教程之Expressjs一篇文章快速入门
- 3D人脸重建:从基础知识到识别/重建方法!
猜你喜欢

【滑动窗口】第九届蓝桥杯省赛B组:日志统计
![[MySQL] basic use of cursor](/img/cc/39b1e17b48d0de641d3cbffbf2335a.png)
[MySQL] basic use of cursor

Four common ways and performance comparison of ArrayList de duplication (jmh performance analysis)

红杉中国,刚刚募资90亿美元
![[MySQL] trigger](/img/b5/6df17eb254bbdb0aba422d08f13046.png)
[MySQL] trigger
![[Li Kou brush questions] 32 Longest valid bracket](/img/51/1ce4f9e8517dba214ec82b6567c923.png)
[Li Kou brush questions] 32 Longest valid bracket

50 commonly used numpy function explanations, parameters and usage examples

numpy 下载安装

ICML 2022 | flowformer: task generic linear complexity transformer

Five wars of Chinese Baijiu
随机推荐
How do I remove duplicates from the list- How to remove duplicates from a list?
抖音將推獨立種草App“可頌”,字節忘不掉小紅書?
Nodejs教程之Expressjs一篇文章快速入门
【深度学习】PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
JPEG2000-Matlab源码实现
在最长的距离二叉树结点
JS traversal array and string
Sequoia China, just raised $9billion
Acdreamoj1110 (multiple backpacks)
对话阿里巴巴副总裁贾扬清:追求大模型,并不是一件坏事
JS操作dom元素(一)——获取DOM节点的六种方式
js中,字符串和数组互转(一)——字符串转为数组的方法
Fzu 1686 dragon mystery repeated coverage
guava:Collections.unmodifiableXXX创建的collection并不immutable
OneNote in-depth evaluation: using resources, plug-ins, templates
【滑动窗口】第九届蓝桥杯省赛B组:日志统计
麦趣尔砸了小众奶招牌
b站视频链接快速获取
First batch selected! Tencent security tianyufeng control has obtained the business security capability certification of the ICT Institute
Summary of cross partition scheme