当前位置:网站首页>SQL Server learning notes
SQL Server learning notes
2022-07-05 15:09:00 【Blue sky ⊙ white clouds】
- cast(lx as nvarchar) sqlserver String concatenation
- sql server To realize mysql Of find_in_set function
CHARINDEX(cast( {
} as nvarchar),ancestors) > 0
- Insert another table after the query result
INSERT INTO [dbo].[sys_role_menu_tmp] SELECT * FROM [dbo].[sys_role_menu];
- stay SQL Server in , I won't support it Limit sentence , It can be solved in the following ways .
although SQL Server I won't support it Limit , But it supports TOP.
(1) If you want to query the top of the above results 6 Bar record , The corresponding SQL The sentence is :
select top 6 id from tablename
(2) If you want to query the above results 7 To the first article 9 Bar record , The corresponding SQL The sentence is :
select top 3 id from tablename where id not in ( select top 6 id from tablename )
select top @pageSize id from tablename where id not in (
select top @offset id from tablename
)
If you want to check n-m Data between The first 4 The number of lines is n-1, The number in the first line is m-n+1, This enables paging .
5. String splicing
MySQL use concat () function ,SQL Server String splicing of adopts “+” complete .
SQL Server:‘a’+‘b’
MySQL:concat (‘a’,‘b’)
6. Get the current time
Mysql:now()
SQL Server:getdate()
7. Date addition and subtraction
Mysql:date_add()
date_add (date,INTERVAL expr type)
Example :date_add( now(), INTERVAL -1 YEAR)
date_add( now(), INTERVAL 5 DAY)
SQL Server:dateadd()
dateadd (datepart,number,date)
Example :dateadd (yy, -1, getdate())
dateadd (day, 5, getdate())
8. cast() function
Be careful par Are parameters of conversion 
Mysql: locate()
Sql server:charindex()
character string str Number of characters included
MySQL: char_length (str)
SQL Server: len (str) and datalength (str)Transformation format

null Judge

String substitution
Sql server:stuff()
Mysql:insert()
mysql:group_concat() And sql server:for xml path(’’)

边栏推荐
- 两个BI开发,3000多张报表?如何做的到?
- Differences between IPv6 and IPv4 three departments including the office of network information technology promote IPv6 scale deployment
- 长列表优化虚拟滚动
- [detailed explanation of Huawei machine test] happy weekend
- Redis distributed lock principle and its implementation with PHP (1)
- Cartoon: programmers don't repair computers!
- TS所有dom元素的类型声明
- MongDB学习笔记
- Interpretation of Apache linkage parameters in computing middleware
- [C question set] of Ⅷ
猜你喜欢

Garbage collection mechanism of PHP (theoretical questions of PHP interview)

市值蒸发超百亿美元,“全球IoT云平台第一股”赴港求生

Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发

Interview shock 62: what are the precautions for group by?

Super wow fast row, you are worth learning!

亿咖通科技通过ISO27001与ISO21434安全管理体系认证

Reasons and solutions for redis cache penetration and cache avalanche

安装配置Jenkins

How can I quickly check whether there is an error after FreeSurfer runs Recon all—— Core command tail redirection

MySQL----函数
随机推荐
What are CSRF, XSS, SQL injection, DDoS attack and timing attack respectively and how to prevent them (PHP interview theory question)
Super wow fast row, you are worth learning!
P1451 calculate the number of cells / 1329: [example 8.2] cells
R 熵权法计算权重及综合得分
MongDB学习笔记
面试突击62:group by 有哪些注意事项?
729. 我的日程安排表 I :「模拟」&「线段树(动态开点)」&「分块 + 位运算(分桶)」
Ten billion massage machine blue ocean, difficult to be a giant
裁员下的上海
用 Go 跑的更快:使用 Golang 为机器学习服务
MySQL----函数
The elimination strategy of redis
B站做短视频,学抖音死,学YouTube生?
P1451 求细胞数量/1329:【例8.2】细胞
TS所有dom元素的类型声明
爱可可AI前沿推介(7.5)
GPS original coordinates to Baidu map coordinates (pure C code)
社区团购撤城“后遗症”
漫画:优秀的程序员具备哪些属性?
想问下大家伙,有无是从腾讯云MYSQL同步到其他地方的呀?腾讯云MySQL存到COS上的binlog