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

边栏推荐
- Crud of MySQL
- Cartoon: programmers don't repair computers!
- I want to inquire about how to ensure data consistency when a MySQL transaction updates multiple tables?
- 漫画:优秀的程序员具备哪些属性?
- What are the domestic formal futures company platforms in 2022? How about founder metaphase? Is it safe and reliable?
- MongDB学习笔记
- 漫画:程序员不是修电脑的!
- Does maxcompute have SQL that can query the current storage capacity (KB) of the table?
- 百亿按摩仪蓝海,难出巨头
- CPU design practice - Chapter 4 practice task 3 use pre delivery technology to solve conflicts caused by related issues
猜你喜欢

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

Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology

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

面试突击62:group by 有哪些注意事项?

社区团购撤城“后遗症”

【数组和进阶指针经典笔试题12道】这些题,满足你对数组和指针的所有幻想,come on !

12 MySQL interview questions that you must chew through to enter Alibaba

Select sort and bubble sort

Super wow fast row, you are worth learning!

Drive brushless DC motor based on Ti drv10970
随机推荐
Reasons and solutions for redis cache penetration and cache avalanche
Cartoon: what are the attributes of a good programmer?
CPU design related notes
超级哇塞的快排,你值得学会!
CPU design practice - Chapter 4 practice task 3 use pre delivery technology to solve conflicts caused by related issues
useMemo,memo,useRef等相关hooks详解
Install and configure Jenkins
Common redis data types and application scenarios
Does maxcompute have SQL that can query the current storage capacity (KB) of the table?
GPS original coordinates to Baidu map coordinates (pure C code)
想问下大家伙,有无是从腾讯云MYSQL同步到其他地方的呀?腾讯云MySQL存到COS上的binlog
两个BI开发,3000多张报表?如何做的到?
Can I pass the PMP Exam in 20 days?
MySQL之CRUD
面试突击62:group by 有哪些注意事项?
Detailed explanation of QT creator breakpoint debugger
Ctfshow web entry command execution
【華為機試真題詳解】歡樂的周末
CPU design practice - Chapter 4 practical task 2 using blocking technology to solve conflicts caused by related problems
CODING DevSecOps 助力金融企业跑出数字加速度