FIX: SQLDMO GetProcessInputBuffer Returns Incorrect Result

This article was previously published under Q281843
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 351268 (SHILOH_bugs)
BUG #: 351286 (SHILOH_bugs)
BUG #: 100990 (SQLBUG_70)
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 theMicrosoft 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 theMicrosoft 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 SubPrivate 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 = NothingEnd 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.
GetProcessInputBuffer inputbuffer SQL-DMO DMO ProcessInputBuffer
Properties

Article ID: 281843 - Last Review: 01/16/2015 21:18:40 - Revision: 3.2

  • Microsoft SQL Server 2000 Standard Edition
  • Microsoft SQL Server 7.0 Standard Edition
  • kbnosurvey kbarchive kbbug kbfix kbsqlserv2000sp1fix KB281843
Feedback