Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / CLR / July 2008

Tip: Looking for answers? Try searching our database.

To update a clr dll should I drop the assembly?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SammyBar - 01 Jul 2008 16:35 GMT
Hi all,

I'm updating by hand a dll containing clr code for Sql 2005 stored
procedures. My question is which are the steps needed to update the dll to
the new compilation?
The file is not locked so I can overwrite the old version with the new one,
but it looks like the sql server does not understand the changes 'cause it
caches the old version somewhere.
Supposing the stored procedure interfaces does not change from version to
version, should I drop the assembly and recreate it and the sp declarations?

Thanks in advance
Sammy
Fred - 01 Jul 2008 17:22 GMT
Dans : news:%23w$%23ZA52IHA.2524@TK2MSFTNGP04.phx.gbl,
SammyBar écrivait :
> Hi all,

Hello,

> I'm updating by hand a dll containing clr code for Sql 2005 stored
> procedures. My question is which are the steps needed to update the
[quoted text clipped - 5 lines]
> version to version, should I drop the assembly and recreate it and
> the sp declarations?

That's what I do.
SQL Server loads the assembly. It doesn't keep a link to the dll file.
I have a script that drops all the function and procs and the assembly,
loads the new version and recreate all functions and procs.
Something like this :

DECLARE @Path nvarchar(1000)
SET @Path = 'C:\Assemblies\'
IF  EXISTS (SELECT * FROM sys.objects WHERE name = N'MyFunction' AND
type=N'FS')
DROP FUNCTION dbo.MyFunction

...

IF EXISTS(SELECT * FROM sys.assemblies WHERE name='MyAssembly')
DROP ASSEMBLY [MyAssembly]
CREATE ASSEMBLY [MyAssembly]
FROM @Path + 'MyAssembly.dll'
WITH PERMISSION_SET = SAFE ;

...

CREATE FUNCTION MyFunction(@myParam1 nvarchar(MAX), @myParam2 xml)
RETURNS xml
EXTERNAL NAME [MyAssembly].[MyClassName].[MyFunction]

The problem (that I don't have) is when you can't drop some objects
(used in constraints for example).

Perhaps is there another way to do but this works fine in my case.

Signature

Fred
foleide@free.fr

Fred - 02 Jul 2008 06:22 GMT
Dans : news:%23tW1Za52IHA.4488@TK2MSFTNGP02.phx.gbl,
Fred écrivait :
> Dans : news:%23w$%23ZA52IHA.2524@TK2MSFTNGP04.phx.gbl,
> SammyBar écrivait :
[quoted text clipped - 13 lines]
>
> That's what I do.

But it exists an ALTER ASSEMBLY instruction that can meet your
requirements. I didn't try it.

Signature

Fred
foleide@free.fr

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.