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?
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.
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.
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.
Check out SqlContext.IsAvailable
Following code should return different assembly information in both cases.
System.Reflection.Assembly.GetEntryAssembly();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With