Microsoft KB Archive/281843

= FIX: SQLDMO GetProcessInputBuffer Returns Incorrect Result =

Article ID: 281843

Article Last Modified on 10/30/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition
 * Microsoft SQL Server 7.0 Standard Edition

-



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 &quot;Language buffer&quot; 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);



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(&quot;dbcc Inputbuffer(&quot;&str$(spid) & &quot;)&quot;) -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 &quot;(local)&quot; 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(&quot;dbcc inputbuffer(&quot; & Str$(spid) & &quot;)&quot;) If (oQueryResults.Rows <> 1) Then InputBuffer = &quot;&quot; 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.

Additional query words: GetProcessInputBuffer inputbuffer SQL-DMO DMO ProcessInputBuffer

Keywords: kbbug kbfix kbsqlserv2000sp1fix KB281843

-

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

© Microsoft Corporation. All rights reserved.