San,
A TVF comprises of two methods -
a) One that returns you an enumerator
b) Second that splits the enumerated rows into columns.
In order to find the SQL Query inside, simply decompile the TVF assembly
using Lutz Roeder's reflector. Note that it might not be a query, or maybe
not that straightforward, but you will be able to tell that once you look at
the decompiled code.
- Sahil Malik [MVP]
Upcoming ADO.NET 2.0 book -
http://tinyurl.com/9bync
----------------------------------------------------------------------------
---------------
"san" <(E-Mail Removed)> wrote in message
news:3E1EAC72-47D7-4283-90DA-(E-Mail Removed)...
> Hi,
>
> I wanted to find out how one can get the query (the actual SQL statement)
in
> a TVF that is calling the said TVF?
>
> Example:
> select * from SOME_TVF() where blah...
>
> SOME_TVF()
> {
>
> // Something like......
> string query = GetCallingQuery()
>
> //now query = "select * from SOME_TVF() where blah..."
>
> }
>
> Thanks,
> Sandeep