当前位置:网站首页>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(’’)
边栏推荐
- Detailed explanation of QT creator breakpoint debugger
- CPU design practice - Chapter 4 practice task 3 use pre delivery technology to solve conflicts caused by related issues
- 【C 题集】of Ⅷ
- GPS原始坐标转百度地图坐标(纯C代码)
- 可视化任务编排&拖拉拽 | Scaleph 基于 Apache SeaTunnel的数据集成
- 两个BI开发,3000多张报表?如何做的到?
- Cartoon: programmers don't repair computers!
- 我这边同时采集多个oracle表,采集一会以后,会报oracle的oga内存超出,大家有没有遇到的?
- P1451 calculate the number of cells / 1329: [example 8.2] cells
- Using tensorboard to visualize the training process in pytoch
猜你喜欢
两个BI开发,3000多张报表?如何做的到?
12 MySQL interview questions that you must chew through to enter Alibaba
Ctfshow web entry information collection
浅谈Dataset和Dataloader在加载数据时如何调用到__getitem__()函数
[detailed explanation of Huawei machine test] character statistics and rearrangement
Talking about how dataset and dataloader call when loading data__ getitem__ () function
可视化任务编排&拖拉拽 | Scaleph 基于 Apache SeaTunnel的数据集成
Surpass palm! Peking University Master proposed diverse to comprehensively refresh the NLP reasoning ranking
Under the crisis of enterprise development, is digital transformation the future savior of enterprises
Ten billion massage machine blue ocean, difficult to be a giant
随机推荐
你童年的快乐,都是被它承包了
How to paste the contents copied by the computer into mobaxterm? How to copy and paste
【C 题集】of Ⅷ
Mysql---- function
TS所有dom元素的类型声明
Live broadcast preview | how to implement Devops with automatic tools (welfare at the end of the article)
Ctfshow web entry explosion
【華為機試真題詳解】歡樂的周末
DVWA range clearance tutorial
市值蒸发超百亿美元,“全球IoT云平台第一股”赴港求生
亿咖通科技通过ISO27001与ISO21434安全管理体系认证
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
Two Bi development, more than 3000 reports? How to do it?
Change multiple file names with one click
Magic methods and usage in PHP (PHP interview theory questions)
Stm32+bh1750 photosensitive sensor obtains light intensity
easyOCR 字符识别
可视化任务编排&拖拉拽 | Scaleph 基于 Apache SeaTunnel的数据集成
sql server char nchar varchar和nvarchar的区别
裁员下的上海