Page 1 of 1

Batch statement produces error

Posted: Wed 19 Nov 2014 19:57
by Der_Meister
I met this bug in old editions, then it has been fixed. Now it returned back.

Execute simple statement:

Code: Select all

SELECT * FROM sys.tables;

SELECT * FROM sys.views;

SELECT @@version;
Error messages will be shown:

Code: Select all

SQL.sql: Error (5,1): sp_cursoropen/sp_cursorprepare: The statement parameter can only be a batch or a stored procedure with a single select, without FOR BROWSE, COMPUTE BY, or variable assignments.
SQL.sql: Error (1,1): Procedure sp_cursoropen. The cursor was not declared.
Query opened in 0.203s [0.199s exec, 0.004s fetch]
dbForge executes 3 queries:

Code: Select all

declare @p3 int
set @p3=0
declare @p4 int
set @p4=0
exec sp_executesql N'declare @handle int, @rows int
                 exec sp_cursoropen @handle OUT,N''SELECT * FROM sys.tables;

SELECT * FROM sys.views;

SELECT @@version;'',1, 1, @rows OUT;
                 select @handler=@handle; select @rowCount=@rows',N'@handler int output,@rowCount int output',@handler=@p3 output,@rowCount=@p4 output
select @p3, @p4

Code: Select all

SET FMTONLY OFF; SET NO_BROWSETABLE ON;SELECT * FROM sys.tables;

SELECT * FROM sys.views;

SELECT @@version; SET NO_BROWSETABLE OFF;

Code: Select all

SELECT * FROM sys.tables;

SELECT * FROM sys.views;

SELECT @@version;
dbForge Studio for SQL Server 4.0.35

Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64)
Apr 2 2010 15:48:46
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.0 <X64> (Build 6002: Service Pack 2)

Re: Batch statement produces error

Posted: Thu 20 Nov 2014 13:46
by alexa
We were able to reproduce this issue and will fix it in one of the next product builds. We will notify you once it's available for downloading.

In the meanwhile, in order to avoid such an issue, you can switch off Paginal mode. This can be done either from the toolbar of Data Editor or in the 'Options' dialog:

1. Select 'Tools -> Options' from the main menu. The 'Options' window opens.
2. Navigate to the 'Data Editor -> General' branch.
3. Unselect the 'Use paginal mode by default' option.

Please also see the 'Paginal Mode' topic in the product's Help documentation.