APPEND PROCEDURES Command Example

The following example opens the testdata database. A temporary table named mytable with a single memo field is created, and REPLACE is used to place a stored procedure named MyProcedure in the memo field. COPY MEMO is used to create a temporary text file named Mytemp.txt that contains the contents of the memo field.

APPEND PROCEDURES is used to append the stored procedure from the temporary text file to the database. DISPLAY PROCEDURES displays the stored procedures in the database and then the temporary table and text file are erased.

Note   To view or edit stored procedures through the user interface, use the Database Designer.

CLOSE DATABASES
* Open the testdata database
OPEN DATABASE (HOME(2) + 'Data\testdata')

* Create a free, temporary table with one memo field called mProcedure
CREATE TABLE mytable FREE (mProcedure M)
APPEND BLANK          && Add a blank record to mytable

* Add PROCEDURE command, name, and carriage return/linefeed to 
* memo field
REPLACE mProcedure WITH "PROCEDURE MyProcedure" + CHR(13) + CHR(10)

* Copy contents of memo field to temporary file
COPY MEMO mProcedure TO mytemp.txt
USE             && Close the temporary table

APPEND PROCEDURES FROM mytemp.txt   && Copy procedure to the database
CLEAR

* Display the procedures associated with the current database
DISPLAY PROCEDURES
DELETE FILE mytable.dbf     && Erase temporary table
DELETE FILE mytable.fpt     && Erase temporary table memo file
DELETE FILE mytemp.txt      && Erase temporary text file