Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Posts
    1

    Unanswered: Multi-statement Table-valued Functions

    Hello

    I am trying to do the following:

    1. Create a Multi-statement Table-valued Functions, say mstvF1, with 1 parameter.
    2. Then, use it like this: "Select * from table T, mstvF1( T.id )"

    It gives me Line 100: Incorrect syntax near 'T', referring to the T of T.id.

    If I do
    Select * from table T, mstvF1( 5 ), then it works.

    Is there any way to do a select from a table T combined with an MSTV function and passing in as a parameter a field from T?

    Thanks for any help.

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    The function can only take in 1 parameter...

    The table you're referencing is many rows...

    What does the function do?

    Can you post that code?

    I don't think you can do it that way...

    What about

    Select *, mstvF1( T.id ) from table T

    ????
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Sep 2003
    Posts
    522
    this will not work either. a table-valued function cannot be used with joined select having one of the fields to be used as a parameter. it does not matter how many parameters, as long as they are fed from the participant of the select.

  4. #4
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    Why don't you post some sample ddl and data, then show us what you are trying to accomplish. It sounds like you're confused on what different types of functions do. If you think about what you're trying to do there, it really doesn't make sense as it would make a table for every single T.id which would be a big mess.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

Posting Permissions

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