Adding Columns

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Exploring and Changing the Database Structure > Designing Tables in Design Editor >

Adding Columns

DatabaseSpy provides different methods for adding columns to a table: you can either define a new column from scratch in the Design Editor, or re-use an existing column definition from a different table.

 

 

To create a new column:

1.In the Design Editor, do one of the following:

 

Select the table and choose the menu option Design Editor | Create New Column.
Press Alt+C.
Right-click the table and select Insert new | Column from the context menu.
Click the plus ic_add-column icon to the right of the last column name.

The column is inserted into the table and shows a New ic_new-column icon to the left of the column name which is highlighted for editing.

 

2.Enter a descriptive name for the column and press Enter. The SQL statement in the Database Structure Change Script window is updated.
3.Optionally, repeat steps 1 and 2 to insert additional columns.
4.Modify the column properties as required.
5.Optionally, change the column order by right-clicking a column and selecting Move Column Up or Move Column Down from the context menu.
6.Execute the change script.

 

 

To duplicate columns from other tables:

1.Select the column to be duplicated in the Online Browser or in the Design Editor and, keeping the mouse button pressed, drag it into the Columns section of the table design where you wish to add the column.
2.Optionally, edit the column properties and/or the column name.
3.Execute the change script.

 

 

To generate SQL for creating a column using an existing column definition:

1.In the Online Browser, right-click the column that serves as a model for the new column to be created.
2.Select the menu option Show in new SQL Editor | Add from the context menu.
3.In the SQL Editor, change the column name and edit the column definition, if required.
4.Click the Execute dbs_ic_execute_script button or press F5.

© 2019 Altova GmbH