FOR BROWSE | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive


Hi I got the following error message (only sql 2005) when I make the query: Select maximo from cont_moviment_bancaria FOR BROWSE Microsoft SQL Server:16907[Microsoft][ODBC SQL Server Driver][SQL
Server]’FOR BROWSE’ is not allowed in cursor statements.Microsoft SQL
Server:8180[Microsoft][ODBC SQL Server Driver][SQL Serve What am I suppose to do?
Can someone help Me?
quote: select_statement is a standard SELECT statement that defines the result set of the cursor. The keywords COMPUTE, COMPUTE BY, FOR BROWSE, and INTO are not allowed within a select_statement of a cursor declaration. SQL Server implicitly converts the cursor to another type if clauses in select_statement conflict with the functionality of the requested cursor type. For more information, see Implicit Cursor Conversions.

Satya SKJ
Microsoft SQL Server MVP
Contributing Editor & Forums Moderator
This posting is provided AS IS with no rights for the sake of knowledge sharing.
If this is your whole statement, just leave out the FOR BROWSE. If it isn’t the complete statement, please post it here, so it will become clearer. —
Frank Kalis
Microsoft SQL Server MVP
hi, It can be used for the concurrence control I found this in the sql help:
"Cursors declared with FOR BROWSE must wait for uncommitted changes (made by anyone, including the cursor owner) only during the OPEN CURSOR operation. After the cursor is open, subsequent changes do not cause the cursor to wait. When a cursor is reopened, it can be blocked by uncommitted changes." complete statement: my function fPegaContador(): Select maximo from sTabela FOR BROWSE Select maximo from sTabela into :nMax If nMax = NUMBER_Null
Set sSql = Insert into sTabela (maximo) values (1) Else
Set sSql = Update sTabela set maximo = maximo + 1 FOR BROWSE ensure that the same code will not be introduced if 2 or more users try to insert data at the same time I’m wrong? thank’s.
If you check the DECLARE CURSOR syntax, you will notice that the SELECT statement for the cursor cannot include FOR BROWSE. But of course the script you posted doesn’t declare a cursor … Not sure about your syntax here:
Select maximo from sTabela into :nMax
Is this SQL 2005-specific?
so, if I don’t declare a cursor why I receive the error message: ‘FOR BROWSE’ is not allowed in cursor statements? And "Select maximo from sTabela" is a common query, no specific.
maximo is a column. sTabela is a variable. but the error message is specific from sql 2005, in the sql 2000 is working!
I was wondering about the "INTO :nMax" bit, which is not quite T-SQL as I know it.
I’m sorry, this syntax belong to programming language Centura or SqlWindow

Apparently the library that your program is using to connect to the SQL Server backend changes your SELECT statement into a cursor operation. If you put a trace on SQL Server, you can catch the actual statements issued by the library against SQL Server. Not sure I’ve heard Centura or SqlWindow mentioned on this forum before, so you might get better suggestions on forums for Centura or SqlWindow. [edit:]It could also be that SQL Server decides by itself that it has to use a cursor, because of the statement issued by the library.
thanks everybody for helping me.