Character Functions

CHARINDEX – Return a starting position in a specific character – Character Functions

CHARINDEX returns the position of a specific character. For example, if you want the position of “d” from “Windows”, CHARINDEX returns “4″ because d is positioned 4th character of “Windows”. CHARINDEX is case insensitive. example: Return the position of “d”. SELECT word, CHARINDEX(’d’, word) FROM tbTestTable; word CHARINDEX(word) —————————————- Windows 4 Mac 0 development 1 [...]

Posted in: Character Functions | Comments Off

ChAR, CHR – Convert ASCII code to character – Character Functions

CHAR(for SQL Server) and CHR(for Oracle) can convert ASCII code to character. This is opposite function of ASCII function. example: Convert ASCII to character. SELECT ascii_code, CHAR(ascii_code) FROM tbTestTable; ascii_code CHAR(ascii_code) ————————————————— 97 a 98 b 99 c 120 x 121 y 122 z 65 A 66 B 67 C 88 X 89 Y 90 [...]

Posted in: Character Functions | Comments Off

ASCII – Convert character to ASCII code – Character Functions

You can use ASCII function to convert character to ASCII code. It is easy to use ASCII function. Please look at my example below. example: convert each character to ASCII code. SELECT alphabet, ASCII(alphabet) FROM tbTestTable; alphabet  ASCII(alphabet) —————————- a 97 b 98 c 99 x 120 y 121 z 122 A 65 B 66 [...]

Posted in: Character Functions | Comments Off