Using standard SQL, SQL-92, how can I convert a character to an开发者_运维知识库 ASCII value?
In MySQL it's easy using the ascii() function, but SQL-92 doesn't have this.
It appears the SQL-92 standard doesn't even mention ASCII at all.
As you say, each RDBMS vendor would have its own implementation how to convert char->ascii and ascii->char.
Most name this function ASCII()
.
- SQL Server ASCII
- Postgresql ASCII
- Oracle ASCII
- MySQL ASCII
Create a lookup table with all the ASCII characters and their corresponding values -- there are only 127 of them -- and then just do SELECT [value] FROM [table] WHERE [character] = 'A'
etc.
精彩评论