SQL Server: Create, Alter and Drop an Assembly.


Here is the syntax for creating, Altering and Droping an Assembly in SQL Server:

CREATE ASSEMBLY: Assemblies can be created using CREATE ASSEMBLY command. It takes the path of the DLL as the parameter.
Syntax:

CREATE
ASSEMBLY assembly_name
[ AUTHORIZATION owner_name ]
FROM { <client_assembly_specifier> | <assembly_bits> [ ,...n ]
}
[ WITH PERMISSION_SET = { SAFE | EXTERNAL_ACCESS | UNSAFE } ]
[ ; ]

ALTER ASSEMBLY: Alter the SQL Server catalog properties of an assembly, add or remove files associated with the assembly.
Syntax:

ALTER ASSEMBLY assembly
FROM
client_assembly_specifier | assembly_bits
WITH assembly_option [ ,...n ]
DROP FILE { file_name [ ,...n ] | ALL }
ADD FILE FROM
{ client_file_specifier [ AS file_name ]
| file_bits AS file_name
} [,...n ]
[ ; ]


DROP ASSEMBLY:
The DROP ASSEMBLY statement allows removing an assembly along with its associated files from the database.
Syntax:

DROP
ASSEMBLY assemblyname[,n]
[WITH NO DEPENDENTS]
[;]