JavaScript Editor js editor     Web development 



Main Page

Appends stored procedures in a text file to the stored procedures in the current database.

APPEND PROCEDURES FROM FileName   [AS nCodePage] [OVERWRITE]

Parameters

FileName


Specifies the name of a text file from which the stored procedures are appended.
AS nCodePage


Specifies the code page of the text file from which the stored procedures are appended. Visual FoxPro copies the contents of the text file and, as it does, automatically convert the contents of the text file to the code page you specify. If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message. You can use GETCP(В ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the text file from which the stored procedures are appended. If you omit AS nCodePage, Visual FoxPro copies the contents of the text file from which the stored procedures are appended and, as it does so, automatically converts the contents of the text file to the current Visual FoxPro code page. The current Visual FoxPro code page can be determined with CPCURRENT(В ). If nCodePage is 0, Visual FoxPro assumes that the code page of the text file from which the stored procedures are appended is the same as the code page of the current database, and that no conversion to the current Visual FoxPro code page occurs.
OVERWRITE


Specifies that the current stored procedures in the database be overwritten by those in the text file. If you omit OVERWRITE, the current stored procedures in the database are not overwritten, and the stored procedures in the text file are appended to the current stored procedures.

Remarks

APPEND PROCEDURES is not available in a distributed executable file. If your application uses this command, it will generate the error, "Feature is not available." For more information about restricted and distributable Visual FoxPro files, see Distributable and Restricted Visual FoxPro Features and Files

Use APPEND PROCEDURES to programmatically modify stored procedures in a database. A database must be open and current when APPEND PROCEDURES is issued; otherwise Visual FoxPro generates an error message.

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

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.

В Copy Code
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

See Also



JavaScript Editor js editor     Web development