当前位置:网站首页>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
边栏推荐
- First batch selected! Tencent security tianyufeng control has obtained the business security capability certification of the ICT Institute
- 麦趣尔砸了小众奶招牌
- Yuan Xiaolin: safety is not only a standard, but also Volvo's unchanging belief and pursuit
- Three schemes of SVM to realize multi classification
- 2022菲尔兹奖揭晓!首位韩裔许埈珥上榜,四位80后得奖,乌克兰女数学家成史上唯二获奖女性
- Seven original sins of embedded development
- Quick news: the flybook players' conference is held online; Wechat payment launched "education and training service toolbox"
- 抖音将推独立种草App“可颂”,字节忘不掉小红书?
- R语言做文本挖掘 Part4文本分类
- El table table - sortable sorting & disordered sorting when decimal and% appear
猜你喜欢

966 minimum path sum

guava:Collections. The collection created by unmodifiablexxx is not immutable

互联网快讯:吉利正式收购魅族;胰岛素集采在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

Study notes of grain Mall - phase I: Project Introduction

Set up a time server

Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software

愛可可AI前沿推介(7.6)
![[sliding window] group B of the 9th Landbridge cup provincial tournament: log statistics](/img/2d/9a7e88fb774984d061538e3ad4a96b.png)
[sliding window] group B of the 9th Landbridge cup provincial tournament: log statistics

Absolute primes (C language)
随机推荐
MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.
ICML 2022 | Flowformer: 任务通用的线性复杂度Transformer
Web开发小妙招:巧用ThreadLocal规避层层传值
在Pi和Jetson nano上运行深度网络,程序被Killed
Absolute primes (C language)
技术分享 | 抓包分析 TCP 协议
document.write()的用法-写入文本——修改样式、位置控制
c语言char, wchar_t, char16_t, char32_t和字符集的关系
In JS, string and array are converted to each other (I) -- the method of converting string into array
【Redis设计与实现】第一部分 :Redis数据结构和对象 总结
@GetMapping、@PostMapping 和 @RequestMapping详细区别附实战代码(全)
Thinking about agile development
Forward maximum matching method
SDL2来源分析7:演出(SDL_RenderPresent())
Aike AI frontier promotion (7.6)
R语言做文本挖掘 Part4文本分类
对话阿里巴巴副总裁贾扬清:追求大模型,并不是一件坏事
JS traversal array and string
js通过数组内容来获取数组下标
Nodejs tutorial expressjs article quick start