Microsoft small business knowledge base

Article ID: 891116 - Last Review: November 2, 2013 - Revision: 2.0

Hotfix Download Available
View and request hotfix downloads
This article has been archived. It is offered "as is" and will no longer be updated.
BUG#:200141 (SQL Server 7.0)

On This Page


When you run a query that contains a CASE statement in Microsoft SQL Server 7.0, the SET ANSI_PADDING ON option may not work as expected. This problem occurs when the following conditions are true:
  • The CASE statement contains multiple literal character strings.
  • The literal character strings have different lengths.
  • The literal character strings have trailing spaces.
For example, in the following Transact-SQL script, the SELECT statement returns 'test1result'. The SELECT statement should return 'test1 result'.
DECLARE @x integer
SET @x = 1 
SELECT  CASE WHEN @x = 1 THEN 'test1 ' WHEN @x = 2 THEN 'test2 ' ELSE 'test 3 ' END + 'result'


A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site: (
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.


You must install SQL Server 7.0 Service Pack 4 (SP4) before you install this hotfix

Restart requirement

You do not have to restart your computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace any other hotfixes.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
File name                    Version           Date         Time        Size         
Msvcr71.dll                  8.00.21213.00     09-Jun-2003  18:20      352,256  
Osql.exe                     8.00.796          09-Jun-2003  18:20       57,904  
Sqdedev.dll                  8.00.534          09-Jun-2003  18:20      127,548  
Sqlunirl.dll                 8.00.194          09-Jun-2003  18:20      180,290  
Dbmssocn.dll                 7.00.1081         04-Oct-2002  23:59       28,944  
Distrib.exe                  7.00.1077         06-Sep-2002  23:55       53,520  
Logread.exe                  7.00.1077         06-Sep-2002  23:55       98,576  
Opends60.dll                 7.00.1093         05-May-2003  18:34      155,920  
Rdistcom.dll                 7.00.1077         06-Sep-2002  23:56      250,128  
Replmerg.exe                 7.00.1077         06-Sep-2002  23:55       82,192  
Replres.dll                  7.00.1077         06-Sep-2002  23:56       78,096  
Securityhotfix.sql                             17-Sep-2002  22:52        7,941  
Snapshot.exe                 7.00.1077         06-Sep-2002  23:56      160,016  
Sp4_serv_uni.sql                               30-May-2003  04:21       59,214  
Sqlagent.exe                 7.00.1085         15-Jan-2003  01:33      344,064  
Sqlcmdss.dll                 7.00.1077         06-Sep-2002  23:55       45,056  
Sqldmo.dll                   7.00.1094         16-May-2003  00:18    2,629,632  
Sqlmap70.dll                 7.00.1094         16-May-2003  13:29       81,920  
Sqlservr.exe                 7.00.1150         15-Dec-2004  01:07    5,062,928  
Sqltrace.dll                 7.00.1144         15-Oct-2003  17:09      315,392  
Ssmsso70.dll                 7.00.1081         04-Oct-2002  23:59       45,328  
Ssnmpn70.dll                 7.00.1094         16-May-2003  00:18       24,848  
Ums.dll                      7.00.1079         26-Sep-2002  20:27       57,616  
Xpweb70.dll                  7.00.1094         16-May-2003  13:31      151,552  
Dbmssocn.dll                 7.00.1081         04-Oct-2002  23:59       28,944  
Sqldmo.dll                   7.00.1094         16-May-2003  00:18    2,629,632  
Sqltrace.dll                 7.00.1144         15-Oct-2003  17:09      315,392    


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More information

This hotfix introduces flag 262. When you enable this trace flag, trailing spaces are no longer truncated from literal strings in CASE statements. To enable trace flag 262, use one of the following methods:
  • Set trace flags by using the DBCC TRACEON statement. To enable trace flag 262 by using the DBCC TRACEON statement, run the following Transact-SQL script:
    DBCC TRACEON (262)
  • Set trace flags at a command prompt. To enable trace flag 262 at startup, type the following command at a command prompt:
    sqlservr –d"C:\MSSQL7\Data\master.mdf" –T262
For additional information about the ANSI_PADDING option, visit the following Microsoft Developer Network (MSDN) Web site: (
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
824684  ( ) Description of the standard terminology that is used to describe Microsoft software updates

Applies to
  • Microsoft SQL Server 7.0 Standard Edition
kbnosurvey kbarchive kbautohotfix kbsqlserv700presp5fix kbfix kbbug kbhotfixserver kbqfe KB891116
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support