Article ID: 294445 - View products that this article applies to.
This article was previously published under Q294445
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 54532 (SQLBUG_70)
In Microsoft SQL Server 6.5, the following query executes successfully:
In SQL Server 7.0 versions prior to Service Pack 2 (SP2), the preceding query incorrectly executes successfully.
In SQL Server 7.0 SP2, or later, executing the preceding statement results in this error message:
Server: Msg 2731, Level 16, State 1, Line 1
The width of column 'col1' is 0. This width is not valid.
In SQL Server 6.5, empty strings are treated as single spaces. The statement in the "Symptoms" section creates a table in which the first column has a length of one.
In SQL Server 7.0 versions prior to SP2, empty strings are treated as empty strings and the preceding statement creates a table in which the first column has a length of zero. This is not expected behavior. The column size must require at least 1 byte.
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
254561For more information, contact your primary support provider.
(http://support.microsoft.com/kb/254561/ )INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
In SQL Server 7.0 SP2, and later, you do not get the error message when you set the compatibility level (sp_dbcmptlevel) of the database to 60 or 65. The compatibility level setting causes SQL Server to interpret the empty strings as single spaces and creates a varchar column of length 1 instead of a column length of zero.