Microsoft KB Archive/308113

= FIX: Built-in String Functions Return Incorrect Results =

Article ID: 308113

Article Last Modified on 10/3/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q308113



BUG #: 355607 (SHILOH_BUGS)



SYMPTOMS
The built-in string functions REPLACE, CHARINDEX, or PATINDEX may return incorrect results when used with Unicode characters. The following example demonstrates the problem on a server with code page 1252 and the SQL_Latin1_General_CP1_CI_AS collation: SELECT REPLACE('001002003', '002', N'asd') The correct result should be 001asd003; instead, it returns 00asd003.



RESOLUTION
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack



STATUS
Microsoft has confirmed that this is a problem in Microsoft SQL Server 2000. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.



MORE INFORMATION
On servers with code pages that use double bytes to store characters, or on servers with code page 1252 and the Latin1_General_CI_AS collation, the following SELECT query without prefix N in any of the string constants will show the same problem: SELECT REPLACE('001002003', '002', 'asd')

Keywords: kbbug kbfix KB308113

-

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

© Microsoft Corporation. All rights reserved.