In SQL2000, there is this concept of an "Extended Stored Procedure", which is a function with a certain signature implemented in a dll.
Doing this is not for the faint of heart, since an improperly written function could bring down your whole server.
An extended stored procedure must be written in C or C++.
You can also load and execute COM objects via a set of stored procedures named sp_OA...
Both are somewhat complex subjects so I suggest you refer to BOL for more info.
This MS knowledge base article may also help:
http://support.microsoft.com/kb/190987.
Things are a bit easier in SQOL2005, as you can much more easily call .NET CLR functions.
Jeff Mason
Custom Apps, Inc.
www.custom-apps.com