Vinc 웃
Vinc 웃

Reputation: 1257

Changing Assembly name sql without dropping it

do you know if there is a way to change the name of an assembly in transact-sql. I am using sql server. Alter Assembly look like you can't change the name with it. Do you know a trick or something using a script?

The script I use to create the Assembly:

CREATE ASSEMBLY [RocheWebService2Sql]
AUTHORIZATION [dbo]
FROM 'C:\Program Files\stxkk0\Assemblies\Wssdaw2Sql.dll'
WITH PERMISSION_SET = EXTERNAL_ACCESS

GO

I don't want to drop the assembly as a solution.

Upvotes: 0

Views: 364

Answers (2)

Steve
Steve

Reputation: 5545

First drop any functions that reference it

DROP FUNCTION XXXX

Then drop the assembly

DROP ASSEMBLY YYYYY

Then create the assembly with the right name

CREATE ASSEMBLY WWWW from 'C:\MY.dll' -- WITH PERMISSION_SET = UNSAFE

The recreate your functions

CREATE FUNCTION XXXX(Your parameters)
    RETURNS INT(your return type)
    AS EXTERNAL NAME WWWW.[Namespace].YourMethod

Upvotes: 1

ngneema
ngneema

Reputation: 444

Drop the old and create with the new name

Upvotes: 0

Related Questions