FIX: SQLDMO GetProcessInputBuffer Returns Incorrect Result (281843)
The information in this article applies to:
- Microsoft SQL Server 2000 (all editions)
- Microsoft SQL Server 7.0
This article was previously published under Q281843
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); RESOLUTIONSQL Server 2000To 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.0To 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
STATUSMicrosoft 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.
Modification Type: | Major | Last Reviewed: | 10/30/2003 |
---|
Keywords: | kbBug kbfix kbSQLServ2000sp1fix KB281843 |
---|
|