Code reuse & SQL CLR

  • Thread starter Thread starter saarcarmi
  • Start date Start date
S

saarcarmi

Hi

How can I determine whether my code is ran from within the sql server
or not?

I want to write a block of code which opens a connection to the DB -
using a context connection if it resides in the SQL process and regualr
if it is not.

How could it be done?

Thanks saar
 
Check the value of Microsoft.SqlServer.Server.SqlContext.IsAvailable. If
it's true, your assembly is running within the SQLCLR host.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top