views:

25

answers:

2

Hi, I'm calling a Sybase Stored Proc X that returns data that is used by a servlet.

Within Stored Proc X, Stored Proc get_business_day is called in the following manner:

exec get_business_day @CBDate, -1, @prevBusDay output

So, the result of calling this (in DBArtisan) is:

6/25/2010 12:00:00.000 AM
1 row(s) affected.

The issue is that I do not need this above row to be outputted when executing X, as the output I get (in DBArtisan) is:

6/25/2010 12:00:00.000 AM
-2817773441.669999

This will obviously affect the results obtained by the servlet as it expects only the value -2817773441.669999.

Is there any way to suppress the output of get_business_day appearing when calling X?

Thx Agnyata

A: 

try capturing the result set in a temp table, something like this:

CREATE TABLE #BadResultSet (DateOf datetime)

INSERT INTO #BadResultSet (DateOf)
EXEC get_business_day @CBDate, -1, @prevBusDay output
KM
does not work ... Iget the below message:20:43:20.546 DBMS <SERVER_NAME> -- Number (156) Severity (15) State (2) Server <SERVER_NAME> Incorrect syntax near the keyword 'exec'.
Chapax
still does not work even after the change of order
Chapax
try this: [How can I get data from a stored procedure into a temp table ?](http://stackoverflow.com/questions/166080/how-can-i-get-data-from-a-stored-procedure-into-a-temp-table), I don't have sybase to actually try these out on, but I did this all the time (over ten years ago, so I don't remember it exactly)
KM
Thx KM ... I think this cannot be done in Sybase as per the above thread.
Chapax
if you put data to temp table in get_business_day, then you have to remove "output" keyword after @prevBusDay
Burçin Yazıcı
A: 

here is the what you want to do:

main proc:

...
create table #tmp(
    CBDate datetime
)
EXEC get_business_day @CBDate, -1

select CBDate from #tmp
-- use it

drop table #tmp
-- before end

get_business_day:

create table #tmp(
    CBDate datetime
)
go
create proc get_business_day
as

-- find the value to be inserted into @day
insert into #tmp select @day

go

drop table #tmp
go
Burçin Yazıcı