CLR integration and User Defined functions in SQL Server 2005

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
Back
Top