JavaScript Editor js editor     Web development 



Main Page

You can use macro substitution to store the SQL SELECT statement created for a view into a variable that you use with the AS clause in the CREATE SQL VIEW command.

To create a view using macro substitution

  1. Create a variable and store the SQL SELECT statement in the variable.

  2. In the AS clause of CREATE SQL VIEW command, use the ampersand (&) macro substitution character followed by the variable name.

For example, the following code stores a SQL SELECT statement into the variable MyEmpCustSQL. CREATE SQL VIEW creates a view named EmpCustView using the variable:

В Copy Code
MyEmpCustSQL = "SELECT employee.emp_id, customer.cust_id, ;
   customer.emp_id, customer.contact, customer.company ;
   FROM employee, customer WHERE employee.emp_id = customer.emp_id"
CREATE SQL VIEW EmpCustView AS &MyEmpCustSQL

See Also



JavaScript Editor js editor     Web development