Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is assembly running in SQL Server or from a Windows app

How can I determine if an assembly is running from a SQL Server CLR stored procedure or if it is running from a Windows app?

like image 742
Joe Avatar asked Dec 17 '10 13:12

Joe


People also ask

What is an assembly in SQL Server?

An assembly in SQL Server is an object that references a managed application module (. dll file) that was created in the . NET Framework common language runtime. An assembly contains class metadata and managed code.

Where is SQL Server assembly?

The assembly is stored inside SQL Server - in binary form. You can inspect what assemblies are stored in SQL server using select * from sys. assemblies - but again: those aren't present as files on a disk or anything - those are stored inside SQL Server's data pages.

What is the difference between Windows Server and SQL Server?

The primary difference between SQL Server and Windows Server is what they're made for: SQL Servers store raw data, while Windows Servers allow you to store documents like images, projects, spreadsheets, or Word documents.


2 Answers

Check out SqlContext.IsAvailable

like image 57
Harvey Kwok Avatar answered Oct 04 '22 12:10

Harvey Kwok


Following code should return different assembly information in both cases.

System.Reflection.Assembly.GetEntryAssembly();
like image 26
decyclone Avatar answered Oct 04 '22 11:10

decyclone