Sybase IQ中的开始语句块中的Unload语句不起作用

时间:2019-01-17 12:55:35

标签: stored-procedures sybase-iq

我有一个sybaseiq_file.sql文件,其中包含以下代码

   begin
         select col1,col2, ROW_NUMBER() OVER (PARTITION BY col3 ORDER BY col1) as v_order    into #tmptbl from tbl    
        UNLOAD TABLE #tmptbl TO 'Vinoth.dat'
        drop table #tmptbl
    end

我想将select语句的输出推送到文件。

但是执行时出现以下错误。请帮助解决此问题。

 dbisqlc -c "uid=XXX;pwd=XXX;eng=XXX;links=tcpip(host=XXX;port=XXX)" -q sybaseiq_file.sql

Error in file "sybase_fileiq.sql" at line 0
Syntax error near 'UNLOAD' on line 2

1 个答案:

答案 0 :(得分:0)

使用下面的重写代码解决了该问题

 begin
         select col1,col2, ROW_NUMBER() OVER (PARTITION BY col3 ORDER BY col1) as v_order    into #tmptbl from tbl    
        select * from #tmptbl ># 'Vinoth.dat'
        drop table #tmptbl
    end