This is an old revision of the document!


Hexadecimal Constants in Oracle - Oracle to SQL Server Migration

In Oracle, you can use TO_NUMBER function with x format to represent a hex constant (literal). In SQL Server, you can use the prefix 0x followed by hexadecimal digits.

Oracle:

  -- Represent the hexadecimal constant ABC and use it in an expression
  SELECT TO_NUMBER('ABC', 'xxx') + 10 FROM dual;

SQL Server:

  -- Represent the hexadecimal constant ABC and use it in an expression
  SELECT 0xABC + 10;
You could leave a comment if you were logged in.