Access SMO objects in CLR proc

Category: sql server smodmo

Question

bertcord on Sat, 10 Jun 2006 13:27:18


I would like to write some CLR procs that use SMO objects.  In visual studio I am unable to add refrences to the SMO objects.  How can I do this?

Thanks

Bert

Replies

Allen White on Mon, 19 Jun 2006 19:21:19


Because CLR was designed to work within the SQL Server engine the references available for a CLR assembly are limited.  The assemblies actually run within the SQL Server context, not as operating system processes.

What would you want to do using SMO that you can't do using Transact-SQL?

Eric Livergood on Sat, 19 Aug 2006 17:56:17


You are unable to add them because SMO is dependent on Batchparser90.dll which is half managed/half unmanaged code, so SQL server will not load it.  They don't show up in visual studio for this reason.

If you want to use assemblies that don't show up, try creating just a normal class library and then use the CREATE ASSEMBLY T-SQL command. You will have to load all of your external assemblies as well, so I would see if they load before you start writing it, as some will and some wont.

 

Roman.Pokrovskij on Wed, 29 Jan 2014 11:15:03


Allen>What would you want to do using SMO that you can't do using Transact-SQL?

I could answer for author: script index.