Adding and Copying Rows

www.altova.com このトピックを印刷 前のページ 1つ上のレベル 次のページ

ホーム >  Retrieving and Editing Data >

Adding and Copying Rows

New rows can be added in the result grid of the SQL エディター, provided that data was retrieved in Editing mode, see Retrieving and Editing Data. The ツールバー of the 結果ウィンドウ provides the Append a new row command for this purpose. This command inserts an empty row where you can enter data and save the record using the Commit ボタン.

dbs_append_row_example

You can define in the SQL エディターオプション that the 個々の デフォルトの値 of the individual columns be inserted into new rows. In the example above, only the columns created_at and updated_at have a デフォルトの値 defined; DatabaseSpy hence populates them automatically. If the default property has not been set accordingly, a blank row will be inserted into the result grid.

 

In addition to editing rows manually, you can also paste into the result grid entire cell ranges (rows, columns, or both) from external files such as Microsoft Excel spreadsheets. The external cell ranges can be pasted over existing cells of the Result grid.

 

To paste clipboard data from external files into new rows, first click Append a new row ( dbs_ic_append ) to create the required number of rows, and then paste the clipboard cells at the desired location. The Paste command is available both as a キーボードショートカット (Ctrl+V) or from the Edit | Paste メニュー。

 

If you are pasting data from a different result grid of DatabaseSpy, it is possible to create the required number of new rows automatically as you paste data. To do this, right-click the 結果ウィンドウ and select the 「新規の行として張り付ける」 (Ctrl+Shift+V) command をコンテキストメニューから選択します。

 

Adding new records to incomplete selections of data

When not the entire table but a collection of individual columns is selected for data editing, the following restrictions apply when a new row is to be inserted into the result grid:

 

The column(s) containing the table's primary key must be included to make data editing possible.
All columns with the "Nullable" property not set must be included unless they have a デフォルトの値 defined.

 

Using the table below as example, let's assume that both the NAME and the STATUS columns are not nullable, but only the STATUS column has a デフォルトの値 ("Standard") defined.

tab_result-new-line

We could further assume that each new customer is automatically assigned status "Standard" and thus omit the STATUS column when creating new customers. Adding new rows is possible in this case since the デフォルトの値 is automatically assigned when the record is committed to the database.

tab_result-add-line

When checking the results of the entire table, you will see that the デフォルトの値 "Standard" has been automatically inserted into the Status column of the new record.

tab_result-add-line-full

However, if you omit, for instance, the Name column, a warning message ("Editing of data is limited for this statement") is displayed when you select the データの編集 command. If you do not want to have this ダイアログボックス displayed, select the 「このダイアログを表示しない!」 チェックボックス or disable this feature in the SQL エディターオプション. After clicking 「OK」, you can still edit data in the 結果ウィンドウ but the Append a new row ic_add_line ボタン and コンテキストメニューオプション are disabled.

tab_result-add-line-disabled

 

Copying rows

If you need to duplicate some of the data stored in your database tables, DatabaseSpy provides a feature allowing you to copy data from the result grid and append that content to the grid in a new row. You can either copy an entire row or individual cells. If you copy data from more than one row and append it as new rows, DatabaseSpy will create as many new rows as there were to host the original data.

 

 

To copy a row and append it to the result grid:

1.Make sure that the 結果ウィンドウ is in the Editing mode.
2.結果ウィンドウ内で、 right-click into the row you want to copy and choose 選択 | 行 をコンテキストメニューから選択します。 または、click several individual data cells using Ctrl+Click.
3.結果ウィンドウを右クリックし、 「選択されたセルのコピー」 をコンテキストメニューから選択、または、click Ctrl+C.
4.結果ウィンドウを右クリックし、 「新規の行として張り付ける」 をコンテキストメニューから選択、または、click Ctrl+Shift+V.

 

Copying records and using data outside DatabaseSpy

You can use the clipboard to export selected records to any other application that supports the clipboard. It might be helpful to include also the headers of the selected data, even if only a fraction of a record set is copied. コンテキストメニュー in the Result tab provides the ヘッダーを持つ選択されたセルをコピー command for this purpose. The corresponding header will be copied to the clipboard together with each selected cell.


(C) 2019 Altova GmbH