You need to create three triggers to control updates to entries and deletions from the new index table. You can make these new triggers identical to the triggers in your template table. (This is the table you used as a sample or template when you created your new index table. For more information, see Creating an Index Table .)
To create the triggers, you run a query that gives you an example or template for the query you want to create, then you search for and replace the trigger name in the template with a new trigger name. In addition, if you have a Sybase database and you use a template to execute the queries, you need to remove the carriage return that Sybase puts after every 250 characters. Finally, you execute the new query to create the trigger.
You complete all the steps in this task using your SQL query tool. Make sure to watch for errors as you run queries.
This section explains these topics:
• | Creating the delete trigger |
• | Creating the insert trigger |
• | Creating the update trigger |
1 | Use this command to display a template for the delete trigger: |
sp_helptext table_d_trig
For example, sp_helptext titlkw_word_d_trig produces this output:
2 | Search for your template’s trigger name (for example, “titlKW_word_d_trig”) and replace it with the name of the delete trigger for your new table (for example, “vtitlKW_word_d_trig”). |
3 | Copy the text from the template results window to a new session window. |
4 | If you have a Sybase database and you are using a template to execute the queries, delete the carriage return that Sybase puts after every 250 characters. |
You can see a carriage return if a line suddenly displays left justified.
5 | Execute the query. |
Your SQL tool creates the new trigger.
1 | Use this command to display a template for the insert trigger: |
sp_helptext table_i_trig
For example, sp_helptext titlkw_word_i_trig produces this output:
2 | Search for your template’s trigger name (for example, “titlKW_word_i_trig”) and replace it with the name of the insert trigger for your new table (for example, “vtitlKW_word_i_trig”). |
3 | Copy the text from the template results window to a new session window. |
4 | If you have a Sybase database and you are using a template to execute the queries, delete the carriage return that Sybase puts after every 250 characters. |
You can see a carriage return if a line suddenly displays left justified.
5 | Execute the query. |
6 | Your SQL tool creates the new trigger. |
1 | Use this command to display a template for the update trigger: |
sp_helptext table_u_trig
For example, sp_helptext titlkw_word_u_trig produces this output:
2 | Search for your template’s trigger name (for example, “titlKW_word_u_trig”) and replace it with the name of the update trigger for your new table (for example, “vtitlKW_word_u_trig”). |
3 | Copy the text from the template results window to a new session window. |
4 | If you have a Sybase database and you are using a template to execute the queries, delete the carriage return that Sybase puts after every 250 characters. |
You can see a carriage return if a line suddenly displays left justified.
5 | Execute the query. |
6 | Your SQL tool creates the new trigger. |
© 1998-2017 Sirsi Corporation