Readme_AssemblyCleanup
The AssemblyCleanup sample contains a .NET Stored Procedure,
written in C#, that cleans-up unused assemblies in the current database by
querying the metadata catalogs.
Its only
parameter, visible_assemblies, is used to specify
whether unused visible assemblies should be dropped or not. A value of 'false'
means by default only unused invisible assemblies will be dropped,
otherwise all unused assemblies will be dropped.
The set of
unused assemblies are those assemblies that do not have any entry points
defined (routines / types and aggregates) and there are no used assemblies
referencing them directly or indirectly.
When
compiling SQLCLR samples, note that the path to the version of the Microsoft
.NET Framework compiler that was distributed with Microsoft SQL Server 2005
must be the first Framework directory in the PATH environment variable. The
location of the compiler shipped with SQL Server 2005 is either drive:\WINNT\Microsoft.NET\Framework\v2.0.xxxxx
or drive:\Windows\Microsoft.NET\Framework\v2.0.xxxxx, where drive
is the installation drive and xxxxx is the
version of the .NET Framework that shipped with Microsoft SQL Server 2005
(which was unknown at the time of publication).
Default
Location: C:\Program Files\Microsoft SQL
Server\90\Tools\Samples\Engine\Programmability\CLR\AssemblyCleanup
1.
Compile the sample using the provided Microsoft Visual Studio
solutions or by using a command similar to the following in a command prompt
window:
sn –k keypair.snk
csc /reference:"C:\Program
Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlaccess.dll" /target:library /debug
/out:CS\AssemblyCleanup\Bin\Debug\AssemblyCleanup.dll CS\AssemblyCleanup\*.cs
2.
Ensure that the
3.
1.
Load the Transact-SQL script in Scripts\test.sql
into SQL Server Management Studio and execute it. This script shows typical
ways to use the sample.
2.
·
SQL Server 2005