function's parameters

function's parameters

Post by Raide » Tue, 11 Nov 2003 13:30:55



Hi!
I'm trying to do something like


RETURNS TABLE
AS
RETURN ( SELECT 'some select statement here' )

GO


RETURNS TABLE
AS

but I get an error with DATEADD :-(

the test1() function?

 
 
 

function's parameters

Post by William Morri » Tue, 11 Nov 2003 16:42:21


You can't do the calculation as you're passing the parameter.  You have to
perform the calculation into a variable, then call the function, like so:




> RETURNS TABLE
> AS




> Hi!
> I'm trying to do something like


> RETURNS TABLE
> AS
> RETURN ( SELECT 'some select statement here' )

> GO


> RETURNS TABLE
> AS

> but I get an error with DATEADD :-(

> the test1() function?


 
 
 

function's parameters

Post by Raide » Tue, 11 Nov 2003 18:38:54


Yes, you are right, I can use DECLARE and SET ... in the Scalar function,
but not in Table-valued function.

So how can I do this in my situation (for function that returns a table)?

> You can't do the calculation as you're passing the parameter.  You have to
> perform the calculation into a variable, then call the function, like so:




> > RETURNS TABLE
> > AS



> > Hi!
> > I'm trying to do something like


> > RETURNS TABLE
> > AS
> > RETURN ( SELECT 'some select statement here' )

> > GO


> > RETURNS TABLE
> > AS

> > but I get an error with DATEADD :-(

to
> > the test1() function?

 
 
 

1. user-defined functions that return a table can't takes getdate() as parameters

Hi,

I have just come across a problem that I can't feed getdate
() to functions that return a table while feeding constant
values like '1/1/01' is allowed. Anybody has comments?
Functions returning a scalar value seem to be fine.
-------------------------

returns table
as
return(
/* select statement here*/
)

---------------------
calling the function
select * from dbo.dum(getdate())

error message:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '('.

whereas feeding constant is fine
select * from dbo.dum(getdate())

2. Current date

3. function parameters as functions

4. Lead WEBSPEED develpoer Project leader

5. Calling a function with a function as a parameter

6. Problem with parent child dimensions and local cubes

7. Passing Parameters to stored parameter queries using VB 5's Data Controls

8. replication logon fail!

9. How does OUTPUT keyword affect parameter's use as INPUT parameter

10. Can't use execute function in MSSQL user-define function

11. Using String Parameter for 'IN' Statement

12. 'Parameters' question

13. ADO Shaped Text and 'RETURN_VALUE' parameters