Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL Anywhere table function returns table?

735 views
Skip to first unread message

marco...@hotmail.com

unread,
Oct 13, 2011, 6:43:37 PM10/13/11
to
/ *
Hello this is my question
in SQL Anywhere can create functions that return tables?
There are table type variables in SQL Anywhere?
or something
in MSQL Server I had a function that returns me a table

Then I had a procedure that called the function
and kept the data in a table variable
now how to do it in SQL Anywhere
the query is slightly longer but I have summarized
* /

CREATE FUNCTION fun_1
(@finicio datetime,
@ffinal datetime)
RETURNS @tab1 TABLE (CIndice int IDENTITY(1, 1) NOT NULL,
CodOperacion numeric(18,0),
CodCliente varchar(10))
AS
BEGIN
DECLARE @masvariables numeric(18,0)

Insert into @tab1 (CodOperacion, CodCliente)
Select CodOP, Cliente from Tabla1
--where .......


return
End

go

Create procedure SP_1
As
declare @finicio datetime
declare @ffinal datetime


declare @vartabla_1 table (
CIndice int NOT NULL, CodOperacion numeric(18,0), CodCliente
varchar(10) )

insert into @vartabla_1
Select CIndice, CodOperacion ,CodCliente from [fun_1]
(@finicio, @ffinal)

/*
more code....
*/

thanks greetings

tduemesnil

unread,
Nov 9, 2011, 10:39:30 AM11/9/11
to
Normaly only Procedures return Result sets ( aka Tables ).
CREATE PROCEDURE proc_1 (@finicio datetime, @ffinal datetime)
RESULT (CIndice int IDENTITY(1, 1) NOT NULL, CodOperacion
numeric(18,0), CodCliente varchar(10))
AS
BEGIN

Select CodOP, Cliente from Tabla1
--where .......

End

bruce.a...@yahoo.com

unread,
Dec 19, 2011, 1:19:39 PM12/19/11
to
This group is no longer active on the Sybase server. In addition, the feed between Google and the Sybase server is not currently working. If you post through Goolge the post will never show up on the Sybase server, and most people who answer questions in that group will never see it. Instead, you may want to access the Sybase newsgroups directly at:

http://www.sybase.com/detail_list?id=11507&pageNum=1&multi=true&show=1248
0 new messages