Problem in User Defined Function returning Table Datatype

Problem in User Defined Function returning Table Datatype

Post by Guru S. anan » Wed, 04 Dec 2002 03:58:38



Hi all

I am having a problem in UDF returning the table Datatype.
With normal scalar return type the function works. WWhat
is the problem in the following function?

I call the function as

SELECT  * from dbo.GetAge1(GETDATE(), GETDATE())

Result shows:

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

The Function created is as follows:


datetime)

(
        age datetime
)
AS
BEGIN




   BEGIN

   END


   BEGIN

           BEGIN

           END
   END



RETURN

END

Thanks in advance,
Anand

 
 
 

Problem in User Defined Function returning Table Datatype

Post by Guru S. Anan » Wed, 04 Dec 2002 04:58:37


Thanks
Anand
Quote:>-----Original Message-----
>There is no message with ID specified in this newsgroup


 
 
 

1. Problem using user defined datatype in function

By one reason or another the following code won't work:

  sp_addtype udtTest, 'varchar(30)';
  go



  (
    id integer,
    value udtTest
  )
  as
  begin
    return;
  end
  go

The SqlServer returns the following error message:

  Server: Msg 2715, Level 16, State 7, Procedure fnTest, Line 3
  Column or parameter #2: Cannot find data type udtTest.

As far as I can see, this is a bug, and it hasn't been fixed in SP2 :-(

Does anyone have a workaround for using userdefined datatypes this way in
functions? (I do NOT want to use "value varchar(30)")

--
Ole Kristian

"Uh, I seem to have forgotten something. What was my name again?"

 - Fizban

2. How to model the Star Schema

3. call a user defined function from another user-defined function

4. Connection persistence

5. Using a User defined function returning a table in a subquery

6. rapidfile

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

8. CAPUTRE DATA (RS232)

9. user-defined function return table with dynamic sql?

10. return datediff function from user defined function.

11. User-Defined Function and TEXT datatype

12. Return concatenated rows from User Defined Function

13. User defined functions doesn't return the correct value in Excel XP