Altova DatabaseSpy 2023 Enterprise Edition

Renaming Database Objects

Home Prev Top Next

You can rename database objects from various contexts:

 

From the Online Browser, by using the context menu

From the Design Editor

By generating an ALTER statement in the SQL Editor

You can also rename an object by editing the "Title" property in the Properties window.

 

Note that support for renaming database objects is not uniform across all databases. The following table illustrates objects that can be renamed directly from the graphical user interface of DatabaseSpy, across various database kinds. Some databases may additionally support renaming of keys, check constraints, indexes, as well as stored procedures.

 

Database kind

Rename table?

Rename column?

Rename view?

Access

-

-

-

Firebird

-

Yes

-

IBM DB2

Yes

-

-

IBM DB2 for i

Yes

-

-

Informix

Yes

-

-

MariaDB

Yes

Yes

-

MySQL

Yes

Yes

-

Oracle

Yes

Yes

-

PostgreSQL

Yes

Yes

Yes

Progress OpenEdge

Yes

Yes

-

SQLite

Yes

Yes

Yes

SQL Server

Yes

Yes

Yes

Sybase

-

-

-

Teradata

Yes

Yes

Yes

 

Renaming objects from the Online Browser

To rename a database object:

 

1.Do one of the following:

 

In the Online Browser, select a database object and press F2 or double-click its title bar in the Properties window.

In the Online Browser, right-click a database object and select Rename from the context menu.

In a Design Editor window, double-click the title bar of a table or the database object, or right-click and select Rename Table or Rename Column or Rename Key or Rename Index or Rename Check Constraint, respectively, from the context menu.

 

2.Change the name as desired and press Enter. DatabaseSpy generates the required script and displays it in the Database Structure Change Script window.

ds_rename_table
Note:At this stage, the changes are not committed to the database yet. In the Online Browser, the icon dbs_ic_changed_col appears to the left of the object name, which indicates that you are about to rename it. To undo the rename operation without committing it to the database, click Refresh data source Refresh (F5) in the Online Browser.

 

3.Optionally, to modify the generated script before running it, click the Edit Change Script Edit Change Script button.

4.In the Database Structure Change Script window, click Execute Change Script dbs_ic_execute_script.

 

Renaming objects from the Design Editor

To rename a database object:

 

1.Do one of the following:

 

In a Design Editor window, double-click the title bar of a table or the database object, or right-click and select Rename Table or Rename Column or Rename Key or Rename Index or Rename Check Constraint, respectively, from the context menu.

 

2.Change the name as desired and press Enter. DatabaseSpy generates the required script and displays it in the Database Structure Change Script window.

 

Note:At this stage, the changes are not committed to the database yet. To undo the rename operation without committing it to the database, click Refresh data source Refresh (F5) in the Online Browser.

 

3.Optionally, to modify the generated script before running it, click the Edit Change Script Edit Change Script button.

4.In the Database Structure Change Script window, click Execute Change Script dbs_ic_execute_script.

 

Renaming objects by generating SQL

To rename a database object by generating an ALTER statement:

 

1.In the Online Browser, right-click a database object and select Show in new SQL Editor | Rename from the context menu.

2.Click the Execute dbs_ic_execute_query button at the top of SQL Editor (or press F5). The outcome is reported in the Message window.

© 2017-2023 Altova GmbH