Microsoft KB Archive/80640

= BUG: Convert Defaults to 30 When No Length Is Given =

Article ID: 80640

Article Last Modified on 2/14/2005

-

APPLIES TO


 * Microsoft SQL Server 4.21a Standard Edition

-



This article was previously published under Q80640



BUG#: NT: 885 (4.2)



SYMPTOMS
A statement of the form,

select convert(varchar, ) from ,

where is a char, varchar, or text column in, returns the first 30 characters of. The documentation for the CONVERT function in the Microsoft SQL Server Transact-SQL Reference states:

  &quot;If no length is specified when converting to varchar or varbinary datatypes, the data adapts to any size necessary.&quot;

That is, if is of type char(100), the above text implies that the above SELECT statement must return all the characters in.



CAUSE
The value of 30 is incorrectly hard coded as the default when no length is specified as the default.



STATUS
Microsoft has confirmed this to be a problem in SQL Server version 4.2.

Additional query words: Windows NT

Keywords: kbbug kbprogramming KB80640

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.