mssql sqlserver 获取特定字符的ascii编码值得方法分享


摘要:
下文分享通过sql自带函数ascii获取特定字符的ascii编码值,如下所示:
实验环境:sql server 2008 R2


在一些特殊字符的替换和检索时,我们可以使用ascii码代替实际数值对数据进行检索,
常见的应用,tab键、回车键的替换操作
下文将讲述在sqlserver中,使用ascii获取对应字符的ascii编码值,
例:

  /*
获取反斜杠的ascii
回车(Enter)的ascii
tab的ascii
空格键的ascii
*/

select ascii('\') as [反斜杠ascii],
ascii('
') as [回车_ascii],
ascii('	') as [tab_ascii],
ascii(' ') as [空格_ascii],
ascii('A') as [A]
mssql_sqlserver_获取特定字符的ascii编码值

mssql_sqlserver_获取特定字符的ascii编码值