on 2014 Aug 08 12:25 PM
I created the following procedure in IQ
create procedure stage.test_proc
as
begin
declare @sql nvarchar(1000)
select @sql = 'select top 10 * into #temp from systable'
execute(@sql)
select * from #temp
end
But I go the following error when I execute sp in interactive sql. what did I do wrong
Cursor not open SQLCODE=-180, ODBC 3 State="34000"
Request clarification before answering.
Sybase IQ is SAP IQ.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes - but this forum is concerned with SAP SQL Anywhere - a different product. There are some similarities in some of the tools but you are more likely to get help on a forum where people use the product you are asking about.
The problem could be with your
select @sql='select...'statement. You could try using
SET @SQL='select....'
In Watcom-SQL syntax (rather than T-SQL that you seem to be using) this works (on SQL Anywhere v11.0.1):
alter procedure test_proc() RESULT ( table_id unsigned int ,file_id smallint ,count unsigned bigint ,first_page smallint ,last_page int ,primary_root int ,creator unsigned int ,first_ext_page smallint ,last_ext_page smallint ,table_page_count int ,ext_page_count int ,object_id unsigned bigint ,table_name char(128) ,table_type char(8) ,view_def long varchar ,remarks long varchar ,"replicate" char(1) ,existing_obj char(1) ,remote_location long varchar ,remote_objtype char(1) ,srvid unsigned int ,server_type char(7) ,primary_hash_limit smallint ,page_map_start smallint ,source long varchar ,"encrypted" char(1) ) begin declare @sql nvarchar(1000); set @sql = 'select top 10 * into #temp from systable'; execute immediate @sql; select * from #temp end
User | Count |
---|---|
87 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.