Select an intelligent template to enter predefined SQL code,
	 including automatically determined table columns, into a SQL file or procedural
	 object at the desired location.
 
	 
		Intelligent templates eliminate the need to manually enter column
		  names in 
		  SQL File Editor by automatically presenting table
		  columns for a given table name.
		Intelligent templates come in  two options:
 
	 
| Option | 
Description | 
| With declared variables | 
Automatically populates
the column
 names
 and the where clause. It uses the primary key or the check
 constraint
 for the where clause condition. 
 It also adds the query within a begin-end block so that the
primary key or the check
 constraint variables
defined are
 local
 to the query. 
 
BEGIN 
DECLARE @PK_au_id_var id
SELECT @PK_au_id_var = 10001
SELECT au_id, au_lname, au_fname, phone, address,
city, state, country, postalcode
FROM authors
WHERE au_id = @PK_au_id_var
END  
 | 
| Without declared variables | 
 Automatically populates the column
 names
 and
the where clause. It uses
the primary key or the check
 constraint
 for the where clause condition, but does not declare the primary key or check constaint local variables. 
SELECT au_id,
au_lname, au_fname, phone, address, city, state, country,
postalcode
FROM authors
WHERE au_id = 10001 
 | 
 
 
 
	  
		- 
		In the editor, position the cursor where you want to insert an intelligent
			 template.
	
 
	- 
		Open Content Assist by pressing the Content-Assist key
			 sequence. 
		 
The default is 
			 Ctrl+Space.
 
			Templates appear in the options list with other syntax proposals.
			 
		Note: User-defined datatypes are listed with the original system types on which they are based enclosed within brackets. For example, a user-defined type named mytype1 based on DECIMAL(6, 2) would be listed as mytype1 [DECIMAL(6, 2)].
	 
	
- Select and double-click the intelligent template you want to insert. 
You can also navigate the Content-Assist list using the Up or Down arrow key until you find the template.
 
	 - Enter a table name, or use the Content-Assist key sequence, and select a table from the generated list. 
To use an intelligent template for an object that is not owned by dbo, enter the owner with the object name. For example, for the employee table owned by guest, enter guest.employee.
 
- Press Enter. 
To display  the owner of an object that is not owned by dbo, you must set the Show Owner of Table or View property in the SQL Editor Code Assist preferences page. 
 The editor lists columns for the specified table in the SQL code.
 
- Enter values in the placeholders. 
- If you have selected an intelligent template with declared variables, provide values for the variables that have been declared in the inserted template code.
 
-  If you have selected an intelligent template without declared variables, provide values for the corresponding value placeholders.
 
 Press Tab to move the cursor to the next unique variable. Press Shift+Tab to move the cursor  to the previous unique variable.