User Defined Funtions Returns Table

  • I have created a user-defined function that takes one input parameter (varchar) and returns a table. It works fine if I just call this function with a hard-coded input value. Example: SELECT * FROM dbo.myTableFunction('ABC'). It would return all the records I expect.

    However, I cannot pass to this function values from another table, it would not work. Example: SELECT dbo.myTableFunction(myTable.myCol) FROM myTable

    I have used other user-defined functions (not returning table) that works just fine with passing in values from tables.

    Any idea why the function returning table is failing?

    Since the function is returning table, can I join on any of the columns it returns?

    Thanks in advance.

  • I think it mightbe that you are returning a table type that returns more than one row, and you are tyring to stuff it into that one row, and yes you can join the UDF in as long as you alias it.

    Tim C.

    //Will write code for food

    One Windows to rule them all, One Windows to find them,

    One Windows to bring them all and in the darkness bind them

    In the Land of Microsoft where the Shadows lie.


    Tim C //Will code for food

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply