Microsoft KB Archive/924291

= FIX: Error message when you execute a user-defined function in SQL Server 2005: &quot;Invalid length parameter passed to the SUBSTRING function&quot; or &quot;A transport-level error has occurred when receiving results from the server&quot; =

Article ID: 924291

Article Last Modified on 11/4/2007

-

APPLIES TO


 * Microsoft SQL Server 2005 Standard Edition
 * Microsoft SQL Server 2005 Developer Edition
 * Microsoft SQL Server 2005 Workgroup Edition
 * Microsoft SQL Server 2005 Enterprise Edition
 * Microsoft SQL Server 2005 Service Pack 1

-



Bug #: 1209 (SQL Hotfix)

Bug #: 443526 (SQLBUDT)



Notice
Microsoft distributes Microsoft SQL Server 2005 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 fix release.



This article describes the following about this hotfix release:
 * The issues that are fixed by this hotfix package
 * The prerequisites for installing the hotfix package
 * Information about whether you must restart the computer after you install the hotfix package
 * Information about whether the hotfix package is replaced by any other hotfix package
 * Information about whether you must make any registry changes
 * The files that are contained in the hotfix package



SYMPTOMS
When you execute a user-defined function in SQL Server 2005, you receive an error message. This problem occurs if you run the following statement before you execute the user-defined function: SET FMTONLY ON You receive a different error message, depending on the version of SQL Server 2005 that you have installed. If you use SQL Server 2005 Service Pack 1 (SP1), you may also experience other problems.

The original release version of SQL Server 2005
When you execute the user-defined function in the original version of SQL Server 2005, you receive the following error message.

Msg 536, Level 16, State 5, Line 4

Invalid length parameter passed to the SUBSTRING function.

SQL Server 2005 SP1
When you execute the user-defined function in SQL Server 2005 SP1, you experience the following problems:  You receive the following error message:

Msg 109, Level 20, State 0, Line 0

A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The pipe has been ended.)

 The SQL Server service stops. The following access violation is logged in the SQL Server Errorlog file:

SqlDumpExceptionHandler: Process 53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.





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

913089 How to obtain the latest service pack for SQL Server 2005

Hotfix information
A supported hotfix is now 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. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix.

To resolve this problem, submit a request to Microsoft Online Customer Services to obtain the hotfix. To submit an online request to obtain the hotfix, visit the following Microsoft Web site:

http://go.microsoft.com/?linkid=6294451

Note If additional issues occur or 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. To create a separate service request, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Prerequisites
You must have SQL Server 2005 Service Pack 1 (SP1) installed to apply this hotfix.

For more information about how to obtain SQL Server 2005 Service Pack 1, click the following article number to view the article in the Microsoft Knowledge Base:

913089 How to obtain the latest service pack for SQL Server 2005

Restart information
You have to restart the SQL Server service after you apply this hotfix.

Registry information
You do not have to change the registry.

Hotfix file information
This hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain of all the files that you must have to fully update a product to the latest build.

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 item in Control Panel.



WORKAROUND
To work around this problem, change the SET FMTONLY setting to OFF before you execute the user-defined function.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section. This problem was first corrected in SQL Server 2005 Service Pack 2.



MORE INFORMATION
For more information about the naming schema for Microsoft SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:

822499 New naming schema for Microsoft SQL Server software update packages

For more information about software update terminology, 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

<div class="moreinformation_section">

Stack dump information
You receive the following stack dump information in SQL Server 2005 SP1: 2006-08-16 19:30:37.61 spid54     * Short Stack Dump 2006-08-16 19:30:37.62 spid54     014718DE Module(sqlservr+004718DE) 2006-08-16 19:30:37.62 spid54     0108B032 Module(sqlservr+0008B032) 2006-08-16 19:30:37.62 spid54     0108B066 Module(sqlservr+0008B066) 2006-08-16 19:30:37.62 spid54     014680F2 Module(sqlservr+004680F2) 2006-08-16 19:30:37.62 spid54     01BDF9D2 Module(sqlservr+00BDF9D2) 2006-08-16 19:30:37.62 spid54     014688D5 Module(sqlservr+004688D5) 2006-08-16 19:30:37.62 spid54     01023E34 Module(sqlservr+00023E34) 2006-08-16 19:30:37.62 spid54     0136764A Module(sqlservr+0036764A) 2006-08-16 19:30:37.62 spid54     013674C1 Module(sqlservr+003674C1) 2006-08-16 19:30:37.62 spid54     01367356 Module(sqlservr+00367356) 2006-08-16 19:30:37.62 spid54     01BF2102 Module(sqlservr+00BF2102) 2006-08-16 19:30:37.62 spid54     01381DA5 Module(sqlservr+00381DA5) 2006-08-16 19:30:37.62 spid54     01023E34 Module(sqlservr+00023E34) 2006-08-16 19:30:37.62 spid54     01041DD5 Module(sqlservr+00041DD5) 2006-08-16 19:30:37.62 spid54     0103DFD4 Module(sqlservr+0003DFD4) 2006-08-16 19:30:37.62 spid54     01006A96 Module(sqlservr+00006A96) 2006-08-16 19:30:37.62 spid54     01006BBC Module(sqlservr+00006BBC) 2006-08-16 19:30:37.62 spid54     01006DAB Module(sqlservr+00006DAB) 2006-08-16 19:30:37.62 spid54     01447562 Module(sqlservr+00447562) 2006-08-16 19:30:37.62 spid54     0144859B Module(sqlservr+0044859B) 2006-08-16 19:30:37.62 spid54     0144789A Module(sqlservr+0044789A) 2006-08-16 19:30:37.64 spid54     01447720 Module(sqlservr+00447720) 2006-08-16 19:30:37.64 spid54     781329AA Module(MSVCR80+000029AA) 2006-08-16 19:30:37.65 spid54     78132A36 Module(MSVCR80+00002A36)

sqlservr!CMsqlXactImp::ClearAllUpdateSequenceMarkers+0x3b (CONV: thiscall) sqlservr!CMsqlXactImp::RollbackInternal+0x3a (CONV: thiscall) sqlservr!CMsqlXactImp::Rollback+0x31 (CONV: thiscall) sqlservr!CAutoMsqlXact::RollbackNestedXact+0x1b (FPO: [0,0,0]) (CONV: thiscall) sqlservr!CExecuteStatement::RollbackNestedXact+0x14 (FPO: [1,0,0]) (CONV: thiscall) sqlservr!CExecuteStatement::FinishNormalImp+0x8c (CONV: thiscall) sqlservr!CExecuteStatement::FinishOnExceptionImp+0x13 (CONV: thiscall) sqlservr!CMsqlExecContext::FExecute+0x65c (CONV: thiscall) sqlservr!CSQLSource::Execute+0x73b (CONV: thiscall) sqlservr!process_request+0x2e3 (CONV: stdcall) sqlservr!process_commands+0x2e0 (CONV: stdcall) sqlservr!SOS_Task::Param::Execute+0xe2 (CONV: thiscall) sqlservr!SOS_Scheduler::RunTask+0xb9 (CONV: thiscall) sqlservr!SOS_Scheduler::ProcessTasks+0x141 (CONV: stdcall) sqlservr!SchedulerManager::WorkerEntryPoint+0x1a8 (CONV: stdcall) sqlservr!SystemThread::RunWorker+0x7f (CONV: thiscall) sqlservr!SystemThreadDispatcher::ProcessWorker+0x225 (CONV: thiscall) sqlservr!SchedulerManager::ThreadEntryPoint+0x143 (CONV: stdcall) msvcr80!_callthreadstartex+0x1b (FPO: [Non-Fpo]) (CONV: cdecl) msvcr80!_threadstartex+0x66 (FPO: [Non-Fpo]) (CONV: stdcall)

Keywords: kbsql2005sp2fix kbhotfixserver kbfix kbexpertiseadvanced kbqfe kbpubtypekc KB924291

-

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

© Microsoft Corporation. All rights reserved.