Article ID: 152620
Article Last Modified on 11/14/2003
APPLIES TO
- Microsoft SQL Server 4.21a Standard Edition
- Microsoft SQL Server 6.0 Standard Edition
- Microsoft SQL Server 6.5 Standard Edition
This article was previously published under Q152620
BUG# WINDOWS 15473 (4.21a, 6.00, 6.50) (sqlserver)
SYMPTOMS
When inserting into a char or varchar column and the embedded quote sequence (for example, two double quotation marks [""], or two single quotation marks[]) causes the string literal to exceed 255 bytes in length, SQL Server returns the following error message:
CAUSE
SQL Server is checking the length of the string before resolving the multiple quote sequences. If the server resolved the ("") or () sequences before checking the length, the implicit conversion would not fail.
WORKAROUND
Use the CONVERT function to explicitly convert the value.
Here is an example of how to correct the first insert that fails:
use pubs go drop table tblQuotes go create table tblQuotes ( strData char(255) ) go insert into tblQuotes values("""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""") go insert into tblQuotes values(CONVERT(VARCHAR(255),""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""")) go select datalength(strData), strData from tblQuotes go
STATUS
Microsoft has confirmed this to be a problem in Microsoft SQL Server version 4.21a, 6.00, and 6.50. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
Keywords: kbbug KB152620