当前位置:网站首页>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
边栏推荐
- [go][reprint]vscode run a HelloWorld example after configuring go
- One line by line explanation of the source code of anchor free series network yolox (a total of ten articles, you can change the network at will after reading it, if you won't complain to me)
- 50个常用的Numpy函数解释,参数和使用示例
- Shake Sound poussera l'application indépendante de plantation d'herbe "louable", les octets ne peuvent pas oublier le petit livre rouge?
- C language char, wchar_ t, char16_ t, char32_ Relationship between T and character set
- Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
- Sdl2 source analysis 7: performance (sdl_renderpresent())
- Ravendb starts -- document metadata
- Start the embedded room: system startup with limited resources
- SDL2来源分析7:演出(SDL_RenderPresent())
猜你喜欢

互联网快讯:吉利正式收购魅族;胰岛素集采在31省全面落地
![[redis design and implementation] part I: summary of redis data structure and objects](/img/2e/b147aa1e23757519a5d049c88113fe.png)
[redis design and implementation] part I: summary of redis data structure and objects

Aike AI frontier promotion (7.6)

Is it profitable to host an Olympic Games?

This year, Jianzhi Tencent

Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?

愛可可AI前沿推介(7.6)

Caching strategies overview

抖音將推獨立種草App“可頌”,字節忘不掉小紅書?

HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
随机推荐
uni-app App端半屏连续扫码
R3live notes: image processing section
JS operation DOM element (I) -- six ways to obtain DOM nodes
968 edit distance
Shake Sound poussera l'application indépendante de plantation d'herbe "louable", les octets ne peuvent pas oublier le petit livre rouge?
抖音將推獨立種草App“可頌”,字節忘不掉小紅書?
代理和反向代理
MySQL - transaction details
numpy 下载安装
14 years Bachelor degree, transferred to software testing, salary 13.5k
Vim 基本配置和经常使用的命令
guava:Collections. The collection created by unmodifiablexxx is not immutable
@Detailed differences among getmapping, @postmapping and @requestmapping, with actual combat code (all)
js之遍历数组、字符串
[go][reprint]vscode run a HelloWorld example after configuring go
Word bag model and TF-IDF
Redistemplate common collection instructions opsforhash (IV)
Web开发小妙招:巧用ThreadLocal规避层层传值
Nodejs教程之让我们用 typescript 创建你的第一个 expressjs 应用程序
Replace Internet TV set-top box application through digital TV and broadband network