BUG: ROUND Function with NULL Length Returns TDS Error
This article was previously published under Q199105
BUG #: 53421 (SQLBUG_70)
SYMPTOMS
The Transact-SQL ROUND function may return a Tabular Data Stream (TDS) error if the second argument (length) is passed in as NULL.
WORKAROUND
To avoid the problem, check the second argument before passing it in to the ROUND function. If it is NULL, simply return NULL and do not use the ROUND function at all. You can use the ISNULL function to accomplish this.
STATUS
Microsoft has confirmed this to be a problem in SQL Server 7.0.
MORE INFORMATION
The syntax for the ROUND function is: Where:
DB-Library: Possible network error: Bad token from SQL Server: Datastream processing out of sync.
-or-
Net-Library error 0: (null) DB-Library: DBPROCESS is dead or not enabled.
[Microsoft][ODBC SQL Server Driver]Unknown token received from SQL Server.
For example, following query demonstrates this behavior:
However, the if the NULL length is passed directly as: SQL Server returns error message 8116:
Argument data type void type is invalid for argument 2 of round function.
This is true for sp_dbcmptlevel 65 as well.In SQL Server 6.5, such a query returns NULL.
| Article Translations
|
Back to the top
