Peter DeBetta's blog about programming in SQL Server 2008, 2005, etc. using technologies such as T-SQL, .NET, CLR, C#, VB, Visual Studio, and SQL Server Management Studio.
This post is for developers and admins alike.
I have tried many ways to cause a crash in SQL Server 2005 by deploying assemblies with questionable code. To date, Safe and Eternal Access assemblies have not been able to cause any discernable grief, but Unsafe assemblies, on the other hand, have.
Now keep in mind that you need to be a sysadmin in SQL Server to even be able to add the Unsafe assembly, but once it's there, one line of code can bring your SQL Server to a screeching halt.
System.Environment.Exit
This will cause the SQL Server service to simply stop with no exceptions raised.
As for deploying Unsafe assemblies, I recommend avoiding it unless absolute necessary, since most everything that you will need to do can be done in a Safe assembly, with a rare need for even External Access.
Finally, as much as I think great things of the new CLR Integration in SQL Server 2005, my advice is always the same - "Use it with prudence."
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using
About Peter DeBetta
Peter DeBetta is an independent consultant specializing in design, development, implementation, and deployment of Microsoft SQL Server, Microsoft SharePoint Server, and .NET solutions. Peter writes courseware, articles, and books – most notably the title Introducing SQL Server 2005 for Developers from Microsoft Press. Peter speaks at conferences around the world, including TechEd, SQL PASS Community Summit, DevTeach, SQL Connections, DevWeek, and VSLive!
Peter is a Microsoft MVP for SQL Server, an MCP, President of the
North Texas SQL Server User Group, and a member of PASS.
When Peter isn’t working, you can find him singing and playing guitar (click
here to hear an original song by Peter), taking pictures, or simply enjoying life with his wife, son, and new daughter.