Checking the Validity of Saved Data
You can use the Transact-SQL string function ASCII(char_expr) to reveal a character saved in a Microsoft® SQL Server™ database. You can also use the ASCII(column_name) function to reveal the ASCII value for a particular column in the database.
Another way to reveal the code page is to set Automatic ANSI to OEM conversion to OFF and query the data from SQL Query Analyzer.
For example, assume you have saved the character "±" on a server using the OEM code page 437. If you select this data from SQL Query Analyzer (which is using ANSI code page 1252) when Automatic ANSI to OEM conversion is on, you see the "±" character. The OEM 437 "±" (which has an ASCII value of 241) has been converted to the ANSI 1252 "±" (ASCII 177). However, if you select the data from SQL Query Analyzer when Automatic ANSI to OEM conversion is off, you see the "ñ" character (ASCII 241). The OEM 437 ASCII value of 241 has been directly replaced by the ANSI 1252 ASCII value of 241.
Automatic ANSI to OEM conversion | OEM code page 437 | ANSI code page 1252 |
---|---|---|
ON | ± (ASCII 241) | ± (ASCII 177) |
OFF | ± (ASCII 241) | ñ (ASCII 241) |