I have a CLR-integrated Scalar value function (from C# DLL). My configuration script is similar to: sp_configure 'clr enabled', 1 reconfigure go create assembly [MyProject] from 'C:\Program Files\...\MyProject.dll' with permission_set = UNSAFE go create function [dbo].[MyScalar] ( @string VARCHAR(50)) returns VARCHAR(50) AS external name [MyProject].[UserDefinedFunctions].[MyScalar] go Now, the Question: If I backup my database, then restore, is my CLR-integrated MyFunction() readily available (without re-running my CLR script)? Does the original DLL still need to be available to Database? Is MyFunction captured in the database backup? Thanks,Mike
It should be, yes. The CREATE ASSEMBLY function will essentially import the DLL into the database itself. You should be able to restore the database to any appropriate server and have the function available. You should be able to verify by restoring it and looking in the [databasename].sys.assemblies. FYI - you *might* have permission issues on the function on the new server. It's discussed here:
http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/03/06/clr-safety-issues-after-database-restore-to-new-server.aspx. Don't know if it'll apply but just in case you run into it this can be a starting point for you. Hope that helps!