Wednesday, March 28, 2012

information inside a function

Hiii

How can i know, when i'm inside a function, what tables are in the select

if my select is:

select myfunction(x)

from table1

I want to know inside myfunction that the table is table1

is there a way of knowing that?

thanks

One way that I can think of to do this is to perform a SET CONTEXT_INFO before calling your scalar UDF and then using the CONTEXT_INFO function from within the context of the UDF. Another potential is to load the information into a permanent table; however, this will require some thought to avoid collisions with other users. This doesn't sound like a real good idea; how are you planning on using this information?

Kent

The better answer / question is why can't you pass this information as an argument to the function?

|||

thanks for the quick answer

The function has to use a select statement which uses the same table and return a value related to it.

this functions will be used by a different user and i dont want the user to type a lot of input parameters.

|||

Hi snorman,

Can you expand what you are trying to accomplish here?

AMB

No comments:

Post a Comment