How to Create Aggregate function in SQL Server 2008
You must compile your CLR code as a library (.dll) using the .NET build tools or Visual Studio to create the assembly. See the MSDN article on Deploying CLR Database Objects for details. Assuming your source file is Concatenate.vb, you can compile from a command prompt (set your PATH to include the appropriate .NET Framework directory or cd to it):

vbc /target:library /out:Test.dll C:\Concatenate.vb


After compiling the library, you must notify SQL Server of the assembly's existence using CREATE ASSEMBLY. This step will resolve the error you are seeing by adding the assembly to the database catalog. Copy the DLL to the database server and execute T-SQL similar to the following:

CREATE ASSEMBLY Test from 'C:\Test.dll' WITH PERMISSION_SET = SAFE;


After these steps are complete, you can access the functions defined in an assembly using the CREATE AGGREGATE syntax.