![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
/ * 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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |