views:

152

answers:

1

When creating a SQL Server CLR stored procedure, I noticed that I couldn't reference anything in the .net framework as I would normally. After some reading around, I realised that assemblies needed to be loaded into the database first.

Therefore, I loaded in the ones I need but due to P/Invoke had to use the UNSAFE permission set. I can now reference them in my stored procedure code and everything works fine.

However, I'm a little concerned about having to set them to UNSAFE when I don't really know what they are doing. So my question is this:

Is it ok to load the .net framework in as UNSAFE without exactly what it's doing? And how would doing so compromise security/robustness/scalability of sql server (as microsoft warn it could)?

Many thanks.

+1  A: 

It could change the registry, restart services, reboot the server etc. Nothing too important ;-) A simple chart with the differences

See this question too (no answers though) SQL Server 2008: How crash-safe is a CLR Stored Procedure that loads unmanaged libraries

Of course, what are you doing that requires UNSAFE access?

gbn
Using J# zip which internally uses P/Invoke. thanks.
HAdes
OK. SQL Server does not differentiate between rebooting the server or using P/Invoke.
gbn