RazorSQL How to Edit Data

The first step before editing data is to get connected to a database. For more information on getting connected, see How to Get Connected.

Once connected to a database, RazorSQL has multiple options for editing data. They are the following:

1. Edit Table Tool: This is the most robust of the editing options. It allows users to edit data in a spreadsheet like format and also has options for easily editing large text or multi-line data. See below for more information.

2. Edit Query Results Cells: This option allows users to edit data directly in the query results cells. See below for more information.

3. Generate SQL Tools: RazorSQL provides tools for generating SQL Update, Insert, Delete, and Select statements frome existing data. See below for more information.

4. Query Builder: RazorSQL provides a query builder that includes tabs for generating Select, Insert, Update, and Delete statements.


Edit Table Tool

Once connected to a database, RazorSQL enables the "Edit Table Tool" that can be used for editing table data. The edit table tool can be launched via the DB Tools -> Edit -> Edit Table menu option, via the edit table tool toolbar icon, via the right-click menu of the database browser, via the query results toolbar icon, or by double-clicking on a data cell in the query results.

NOTE: To edit query results, the query must have been a select * query executed against a single table.

Once the edit table tool is launched, a window will be displayed. The window will contain the data from the table in a spreadsheet like format. For performance reasons, only so much data is displayed, by default 2500 rows. To display more data, you can enter a higher value in the max rows field, then click the icon next to the field to apply the changes.

The edit tool works like a typical spreadsheet. Users can click on a cell or use the keyboard to navigate to a cell. Once in a cell, the data is editable, and users can edit the data in the cell. If there is a large amount of data in the cell, click the "Edits in New Window" checkbox. This will cause any editing to occur in a new window that provides a larger view of the data to be edited.

Users can add or delete rows using the add and delete buttons on the edit table tool toolbar. No data is actually modified in the table until the changes have been applied. The delete button deletes the currently selected row. The add button inserts a row after the currently selected row. Note that where the row is added has no effect on how the data is stored in the database.

After making any data changes, users can preview the SQL related to the changes using the preview button on the toolbar. To commit / execute any changes made, use the save button.

If updates were made against the table, RazorSQL needs to know what "keys" to use to generate the SQL update statements to modify the data. This ensures that the correct data is modified. If the table you are editing contains primary keys, there is no action needed from the user. If not, the user will need to select an appropriate amount of columns to ensure the correct record is updated.

Other options provided by the edit table tool are a search option, and a find / replace option. This options are located on the toolbar.


Edit Query Results Cells

For certain types of queries, RazorSQL allows users to edit data directly in the query results pane. For the most part, the query has to be a single table select * for the query results cells to be editable.

To edit the cells directly, the user can either select the "On" option in the edit mode dropdown box in the query results toolbar, right-click a cell and select Edit Cell, or double-click a cell and tell RazorSQL that you would like to edit the cell directly.

Once the edit cell mode is turned on, users can type data directly into the query results cells. To preview the edited data, click the save button on the query results toolbar. This will bring up a window displaying the SQL update statements corresponding to any edits that were made. Click the execute button to apply the changes.


Generate SQL Tools

RazorSQL provides tools that can generate SQL update, insert, delete, and select statements from selected query results cells or rows. To use the generate SQL tools, select either one or more cells in the query results, and then right-click. In the Generate SQL menu on the popup-menu, select whether to generate select, update, insert, or delete statements. This will bring up a window with the generated SQL. The SQL can then be copied to the editor via the Copy to Editor button so that users can make any edits to the data in the generated SQL statements.