INCREASE PRODUCTIVITY USING SQL TEMPLATES If you're new to SQL Server and need help increasing productivity in database development, consider using SQL templates. SQL templates are provided with SQL Server 2000. The templates reside in the following 13 categories: * Attach And Detach Database * Create Database * Create Function * Create Index * Create Procedure * Create Statistics * Create Table * Create Trigger * Create View * Manage Extended Property * Manage Linked Server * Manage Login Role User * Using Cursor Script filenames for the templates end in .tql. The following is the basic template to create a stored procedure: -- ============================================== -- Create procedure basic template -- ============================================== -- Creating the stored procedure IF EXISTS (SELECT name FROM sysobjects WHERE name = N'' AND type = 'P') DROP PROCEDURE GO CREATE PROCEDURE <@param1, sysname, @p1> = , <@param2, sysname, @p2> = AS SELECT @p1, @p2 GO -- ============================================== -- example to execute the stored procedure -- ============================================== EXECUTE , GO There is a sophisticated global replace mechanism for template placeholders. After you have opened the template file in query analyzer, the Edit menu includes the option Replace Template Parameters. After selecting this option, a dialog box opens that lists the parameter, type, and value. The value column has default values, which you can override by typing in different values. There is also a Replace All button that will replace the template's placeholders with the default values or overridden values that you have typed. ----------------------------------------