Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    19

    Exclamation Unanswered: User defined function problem

    Hi,
    While i execute the followgin code. it gives error. Please resolve it as while calling the function i want to use getdate() or any other dynamic variable or any select such as

    select title from SalesByStore( select admission_Dte from addmission )

    It gives error.

    --------------------------------------------------------------------------
    use pubs
    go

    createFUNCTION SalesByStore (@storeid datetime)
    RETURNS TABLE
    AS
    RETURN (SELECT top 5 title, qty
    FROM sales s, titles t

    )
    go


    select title from SalesByStore(getdate())

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    When you post a thread about an error, it kinda helps out if you post the error too....
    ...but I suspect the error you are getting is because you are not including the function owner when you call it. UDF calls must include the owner of the function:

    select title from dbo.SalesByStore(getdate())
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •