Partager via


COPY PROCEDURES Command

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

COPY PROCEDURES TO FileName   [AS nCodePage] [ADDITIVE]

Parameters

  • FileName
    Specifies the name of a text file to which the stored procedures are copied. If the file doesn't exist, Visual FoxPro automatically creates it.

  • AS nCodePage
    Specifies the code page for the text file to which the stored procedures are copied. Visual FoxPro copies the stored procedures, and, as it does so, automatically converts the stored procedures 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 to which the stored procedures are copied.

    If you omit AS nCodePage or if AS nCodePage is 0, no code page conversion occurs.

  • ADDITIVE
    Appends the stored procedures to the end of the specified text file. If you omit ADDITIVE, the stored procedures replace the contents of the text file.

Remarks

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

Example

The following example opens the testdata database, and uses COPY PROCEDURES to copy the procedures to a temporary text file named Myproc.txt. MODIFY FILE is used to open the temporary text file, which will be empty if there are no stored procedures in the database.

If there are no stored procedures in the database, you can run the example in the APPEND PROCEDURES Command topic to add a procedure to database.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'data\testdata')

COPY PROCEDURES TO myproc.txt && Copy stored procedures to a file
MODIFY FILE myproc.txt  && Open the file
DELETE FILE myproc.txt  && Erase the file

See Also

Reference

APPEND PROCEDURES Command

CREATE TRIGGER Command

DISPLAY PROCEDURES Command

MODIFY PROCEDURE Command

SET DATABASE Command

Other Resources

Commands (Visual FoxPro)

Language Reference (Visual FoxPro)