当前位置:网站首页>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(’’)

边栏推荐
- CPU设计实战-第四章实践任务二用阻塞技术解决相关引发的冲突
- GPS original coordinates to Baidu map coordinates (pure C code)
- Live broadcast preview | how to implement Devops with automatic tools (welfare at the end of the article)
- 一键更改多个文件名字
- Huawei Hubble incarnation hard technology IPO harvester
- How can I quickly check whether there is an error after FreeSurfer runs Recon all—— Core command tail redirection
- Type declaration of all DOM elements in TS
- Un week - end heureux
- Crud of MySQL
- Mysql---- function
猜你喜欢

计算中间件 Apache Linkis参数解读

Dark horse programmer - software testing -10 stage 2-linux and database -44-57 why learn database, description of database classification relational database, description of Navicat operation data, de

超越PaLM!北大碩士提出DiVeRSe,全面刷新NLP推理排行榜

Ten billion massage machine blue ocean, difficult to be a giant

Live broadcast preview | how to implement Devops with automatic tools (welfare at the end of the article)

Change multiple file names with one click

Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel

729. My schedule I: "simulation" & "line segment tree (dynamic open point) &" block + bit operation (bucket Division) "

729. 我的日程安排表 I :「模拟」&「线段树(动态开点)」&「分块 + 位运算(分桶)」

No one consults when doing research and does not communicate with students. UNC assistant professor has a two-year history of teaching struggle
随机推荐
计算中间件 Apache Linkis参数解读
easyOCR 字符识别
Creation and use of thymeleaf template
可视化任务编排&拖拉拽 | Scaleph 基于 Apache SeaTunnel的数据集成
超越PaLM!北大碩士提出DiVeRSe,全面刷新NLP推理排行榜
30岁汇源,要换新主人了
Drive brushless DC motor based on Ti drv10970
Long list optimized virtual scrolling
sql server char nchar varchar和nvarchar的区别
Ecotone technology has passed ISO27001 and iso21434 safety management system certification
【華為機試真題詳解】歡樂的周末
Huiyuan, 30, is going to have a new owner
Interpretation of Apache linkage parameters in computing middleware
easyOCR 字符識別
裁员下的上海
[JVM] operation instruction
手写promise与async await
Want to ask the big guy, is there any synchronization from Tencent cloud Mysql to other places? Binlog saved by Tencent cloud MySQL on cos
爱可可AI前沿推介(7.5)
Interview shock 62: what are the precautions for group by?