Monday, March 26, 2012

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.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

??|||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.|||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.

No comments:

Post a Comment