Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Command Index > R

RENAME (Short Name: REN)

Scroll Prev Top Next More

Use the RENAME command to change a form, report, label, table, view, or column name, and the database owner's user identifier. You can also use RENAME to change the name of an existing file.

 

RENAME

 

Options

 

COLUMN colname1 TO colname2

Renames a column in one table or in all tables in the open database.

 

filename

Specifies the new name of the file. Wildcards can be used.

 

filespec

Specifies the file you want to rename. Optionally, include a drive and path specification in the form D:\PATHNAME\FILENAME.EXT. Wildcards can be used.

 

FORM formname1 TO formname2

Renames a form in the open database.

 

IN tblname

Specifies the table in which you want to rename a column.

 

LABEL labelname1 TO labelname2

Renames a label in the open database.

 

NOCHECK

Does not update references to views, tables, and columns in forms, reports, labels, access rights, and rules.

 

OWNER ownername1 TO ownername2

Renames an owner in the open database.

 

PROCEDURE procname1 TO procname2

Renames a stored procedure in the open database.

 

REPORT rptname1 TO rptname2

Renames a report in the open database.

 

TABLE tblname1 TO tblname2

Renames a table in the open database.

 

VIEW viewname1 TO viewname2

Renames a view in the open database.

 

About the RENAME Command

 

If you do not want R:BASE to update references to views, tables, and columns when you rename them, include the NOCHECK option with the command.

 

Renaming Columns

You can rename a column in an entire database or in a single table. R:BASE does not update column references in rules. When you rename a column, R:BASE automatically updates references to the column in the following instances:

 

If the column has a description.

If it is used in a form, report, label, computed column, UPDATE access right, or autonumbered column. However, because of possible size problems, R:BASE does not change column references inside an expression in a form, report, or label. These column references must be modified manually through the Form, Report, or Label Designer.

 

Updating Views and Tables

R:BASE automatically updates references to views and tables in the following instances:

 

If you rename a view used in a report, label, or access right.

If you rename a table that has a description, or is used in a form, report, label, or access right.

 

R:BASE does not update table or column references in views.

 

To update a view, delete it with the DROP command and define it again with the CREATE VIEW command, or QBE. To update a rule, you can use the RULES command, or the Database Designer. If you use the RULES command, you must first delete the rule with the DROP command and then add it again with the RULES command.

 

Renaming Tables

When you rename a table that is used as the rule table in a data-entry rule, R:BASE updates the rule definition. However, if you rename a table used in the WHERE clause of a rule definition, you must update the rule yourself. R:BASE does not update table references in views.

 

Renaming Files

When you use RENAME to change the name of a disk file, only the name of the file is changed. The file remains in the same directory on the same drive. You can include a file specification for the file you are renaming but not for the new file name. If you want the file to reside in a different drive or directory, use the COPY command. This command is similar to the operating system command RENAME.

 

On a workstation with multiple drives (local or mapped), especially when the files are on the different drive, it is always the best practice to define a drive letter when copying, deleting, renaming or running files, unless the specified files are located in the working directory. You will not need to specify the drive letter if all of the files are located in the default directory when using the copy, delete, rename, or run commands.

 

Updating Command Files

R:BASE also does not update column, table, view, form, report, or label references in command files or applications. To update command files, use RBEdit or another text editor. To update applications, use the Application Designer.

 

Assigning User Identifiers

You can assign or change the database owner's user identifier with RENAME. The default user identifier is PUBLIC. Until this default is changed, any user can modify the database structure, read, enter, change, or delete data.

 

An owner's user identifer can be a maximum of eighteen characters. It must begin with a letter, and can contain letters, numbers, and the symbols #, $, _, and %, and must be unique among all user identifiers.

 

Examples

 

The following command renames a column from transid to transxno in the transmaster table.

 

RENAME COLUMN transid TO transxno IN transmaster

 

The following command changes the database owner's user identifier from the default PUBLIC to june.

 

RENAME OWNER PUBLIC TO june

 

The following command changes the name of the CUSTOMER file to CUSTOMER.DAT.

 

RENAME customer customer.dat

 

The following command renames all four database files to NYC.RX1, NYC.RX2, NYC.RX3, and NYC.RX4.

 

RENAME newyork.rx? nyc.rx?