当前位置:网站首页>Chapter 118 SQL function reverse
Chapter 118 SQL function reverse
2022-04-21 17:13:00 【yaoxin521123】
List of articles
The first 118 Chapter SQL function REVERSE
Scalar string function , It returns a string in reverse character order .
The outline
REVERSE(string-expression)
Parameters
string-expression- The expression of the string to be reversed . The expression can be a column name 、 String text 、 The result of a number or another scalar function , The basic data type can be expressed as any character type ( for exampleCHARorVARCHAR).
describe
REVERSE Returns a string expression with reversed character order . for example 'Hello World!' Return to '!dlroW olleH'. This is a simple string order reversal , No extra treatment .
The returned string is of data type VARCHAR, Independent of the data type of the input value . Convert numbers to canonical form , Numeric strings are not converted to canonical form until they are inverted .
Leading and trailing blanks are not affected by inversion .
reverse NULL Values can cause NULL.
Be careful : because REVERSE Always return one VARCHAR character string , Therefore, some types of data will become invalid during inversion :
- The reverse list is no longer a valid list , Cannot convert from storage format to display format .
- The reversal date is no longer a valid date , And cannot be converted from storage format to display format .
Example
The following example inverts Name field value . under these circumstances , This causes names to be sorted by middle initials :
SELECT Name,REVERSE(Name) AS RevName
FROM Sample.Person
ORDER BY RevName

Please note that , because Name and RevName Just different representations of the same field , therefore ORDER BY RevName and ORDER BY RevName,Name Perform the same sort .
The following example inverts numbers and numeric strings :
SELECT REVERSE(+007.10) AS RevNum,
REVERSE('+007.10') AS RevNumStr
1.7 01.700+
The following embedded SQL Example inversion $DOUBLE Numbers :
/// d ##class(PHA.TEST.SQLFunction).Reverse()
ClassMethod Reverse()
{
s dnum = $DOUBLE(1.1)
&sql(
SELECT REVERSE(:dnum) INTO :drevnum
)
w dnum,!
w drevnum,!
}
DHC-APP> d ##class(PHA.TEST.SQLFunction).Reverse()
1.1000000000000000888
8880000000000000001.1
The following example shows what happens when you reverse the list :
SELECT FavoriteColors,REVERSE(FavoriteColors) AS RevColors
FROM Sample.Person

The following example shows what happens when the date is reversed :
SELECT DOB,%INTERNAL(DOB) AS IntDOB,REVERSE(DOB) AS RevDOB
FROM Sample.Person

版权声明
本文为[yaoxin521123]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211707207584.html
边栏推荐
- R语言使用Hmisc包的label函数为dataframe中的特定变量(数据列)添加变量标签、将dataframe的数据列名称修改为数据说明标签、而通过数值索引访问dataframe数据列
- LS - Al meaning of each field
- The rebound base has an FD
- 用Jetson Nano 做一个环境气象站
- Dry goods | actual combat drill based on encryption interface test case design
- Vitis HLS build project and generate IP core (vivado HLS)
- R language uses the select function in dplyr package to delete data columns in dataframe based on the index value of data columns
- Vivado verifies the IP core generated by Vitis HLS
- 第118章 SQL函数 REVERSE
- [an article helps you lay a good foundation for routing]
猜你喜欢

824. Goat Latin

Microcomputer principle and interface technology -- electronic organ experiment report

【面试普通人VS高手系列】b树和b+树的理解

mysql为数据库表起别名的注意事项

众测、专属、渗透测试捡破烂小tips

Win10 bridging network card enables QEMU virtual machine to access the network normally

Database Principle -- library management system

前五章内容思维导图

Vivado verifies the IP core generated by Vitis HLS

Multilingual communication foundation 04 grpc and protobuf
随机推荐
Database Principle -- library management system
R语言数据导出(数据保存、导出、持久化到本地指定目录文件)、使用xlsx包的write.xlsx函数将dataframe导出为excel文件xls格式、而非xlsx格式
. net core enterprise wechat web page authorization login
mysql创建数据库sql语句
【动态规划】152. 乘积最大子数组
Tips for idea cup filling -- Realizing mouse sliding guide bag
检测、跟踪、行为识别All-In-One!产业级行人分析系统重磅开源!
使用知行之桥EDI系统做压力测试时如何快速清除文件记录
824. 山羊拉丁文
反弹base存在一个fd的情况
The first five chapters are thought maps
Domain information query tool adfind
Buuctf Web [WANGDING Cup 2018] Fakebook
幹貨 | 實戰演練基於加密接口測試測試用例設計
mysql设置某字段不能重复
R language uses the label function of hmisc package to add variable labels for specific variables (data columns) in dataframe, modify the data column name of dataframe to data description label, and a
/etc/passwd的利用
【newcode】牛牛组队竞赛
解读论文记录 指出经典的RMS证明过程小错误的一个论文的解读
Summary of Wu Enda's course of machine learning (II)