Write a Template with Database Metadata
One of the key uses for code generation is to build code based on database schema. CodeSmith enables this scenario through the use of the SchemaExplorer assembly, which provides types for working directly with SQL Server or ADO data as well as designers that can be used to access those types from CodeSmith. In this tutorial, you'll see how you can use the information available through SchemaExplorer, together with scripting code, to make short work of building a complex T-SQL script.
Next: HTTP Endpoints in SQL Server 2005