FIX: SQLDMO GetProcessInputBuffer Returns Incorrect Result

Article translations Article translations
Article ID: 281843 - View products that this article applies to.
This article was previously published under Q281843
BUG #: 351268 (SHILOH_bugs)
BUG #: 351286 (SHILOH_bugs)
BUG #: 100990 (SQLBUG_70)
Expand all | Collapse all

On This Page

SYMPTOMS

The GetProcessInputBuffer method of a SQLServer object returns a "Language buffer" string instead of the contents of the language buffer. In Microsoft SQL Server 6.5 the GetProcessInputBuffer method works correctly and returns the correct contents of the language buffer.

A sample code fragment is attached:
hr = pSQLServer->GetProcessInputBuffer(spid, &Command);

RESOLUTION

SQL Server 2000

To resolve this problem, obtain the latest service pack for 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

SQL Server 7.0

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
301511 INF: How to Obtain the Latest SQL Server 7.0 Service Pack

WORKAROUND

To work around this behavior either:
  • Use the DBCC INPUTBUFFER statement to retrieve the inputbuffer of the server process ID (SPID). For example:

    Set oQueryResults = oSQLServer.ExecuteWithResults("dbcc Inputbuffer("&str$(spid) & ")")
    -or-

  • Use the following Microsoft Visual Basic code, which works around the problem:
    Private Sub Command1_Click()
        Dim oSQLServer As SQLDMO.SQLServer
    
        Set oSQLServer = New SQLDMO.SQLServer
        oSQLServer.LoginSecure = True
        oSQLServer.Connect "(local)"
        
        Debug.Print InputBuffer(7, oSQLServer)
    End Sub
    
    Private Function InputBuffer(spid As Long, ByRef oSQLServer As SQLDMO.SQLServer) As String
        Dim oQueryResults As SQLDMO.QueryResults
        Set oQueryResults = oSQLServer.ExecuteWithResults("dbcc inputbuffer(" & Str$(spid) & ")")
        If (oQueryResults.Rows <> 1) Then
            InputBuffer = ""
        Else
            InputBuffer = oQueryResults.GetColumnString(1, 3)
        End If
        Set oQueryResults = Nothing
    End Function

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

SQL Server 2000
This problem was first corrected in SQL Server 2000 Service Pack 1.

SQL Server 7.0
This problem was first corrected in Microsoft SQL Server 7.0 Service Pack 4.

Properties

Article ID: 281843 - Last Review: October 30, 2003 - Revision: 3.2
APPLIES TO
  • Microsoft SQL Server 2000 Standard Edition
  • Microsoft SQL Server 7.0 Standard Edition
Keywords: 
kbbug kbfix kbsqlserv2000sp1fix KB281843

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com