TRUNC, TRUNCATE

Previous Next

TRUNC is a convertible function resolved by USoft and thus supported on all RDBMS platforms.

TRUNC is also a native SQL function on Oracle and JDBC. TRUNCATE is a native SQL function on ODBC.

SQL Server does not have a corresponding native function. When resolving TRUNC() on SQL Server, USoft converts the expression to a ROUND() expression and passes it to the RDBMS. If 1 argument is passed:

TRUNC( n1 )

then the following is sent to SQL Server:

ROUND( n1 - 0.5, 0 )

If 2 arguments are passed:

TRUNC( n1, n2 )

then the following is sent to SQL Server:

ROUND( n1 - 0.5 * POWER( 10.0, -(n2) ), n2 )

 

See also

SQL Functions