Write a Template with Database Metadata
One of the key uses for code generation is to build code based on database schema. CodeSmith Generator 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 Generator. 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