dbisql output when using temporary tables in stored procedure -
02-22-2012
, 11:19 AM
Hi.
I'm trying to output results of my stored procedure to an Excel file
and calling this from a batch file to run regularly.
I'm using:
Adaptive Server Enterprise/15.0.3/EBF 16738 ESD#2/P/NT(IX86)/Windows
2003/ase1503/2708/32-bit/OPT/Mon Jul 27
20:19:56 2009
Interactive SQL version 11.0.0 build 1649
Here's my code:
myprocedure.sql :
create procedure dbo.myprocedure()
as
begin
create table #temptable ( myid varchar(10), lname varchar(10),
fname varchar(10) )
insert into #temptable values('1234567890','Smith','John')
select * from #temptable
end
runreport.sql : exec myprocedure ; output to 'myreport.xls' format
html ;
runreport.bat : dbisql -nogui -c "uid=reportuser;pwd=reportuser" -host
myserver -port 5000 read runreport.sql
If I run the sql file in the Interactive SQL GUI, it outputs the excel
file perfectly. But when I run it using the command line dbisql, it
outputs just the headers, no data into the output 'myreport.xls' file.
The data is echoed to screen when -q option is not selected.
This only happens when I use temporary tables for my output. If I just
run a simple select on an existing database table, the output contains
headers & data.
Any suggestions?
Thanks. |