Working with Results (Results Grid)
In addition to the Editor pane, in which you can manipulate data with the
INSERT, UPDATE, and DELETE statements, The SQL Query window provides the
Results pane, which is a graphical interface for viewing or modifying data.
The Results pane has a number of features that you can access from the
Results Toolbar. The following is a list of the features on the toolbar from
left to right:
- First Row: Moves the row indicator to
the first row in the Results grid.
- Previous Row: Moves the row indicator
to the row before the current row in the Results grid.
- Next Row: Moves the row indicator to
the row after the current row in the Results grid.
- Last Row: Moves the row indicator to
the last row in the Results grid.
- Delete Current Row (Ctrl+Del): Deletes
the current row after prompting for confirmation.
- Insert New Row (Ctrl+Ins): Inserts a
new and empty row in the grid. Fill in the data in the columns of the new
row and move off the row to save the changes.
- Saves Results As CSV: Saves the data in
the Results grid to a comma-separated values (CSV) file, with column names
as a header row, for use with Microsoft Excel. This option
limits the results that you can save in a CSV file to the first 65536 rows
in the grid (including header row). To export all rows into CSV, use the
Export Data feature.
- Save Results AS HTML: Saves the data in
the Results grid to a HyperText Markup Language (HTML) file with column
names as a header row. For a sample HTML file, click
here to view the authors table
located in the pubs database.
Updating Data
You can update data in a row by simply editing the text and moving off
the row to save the changes. Clicking inside a cell switches it to edit mode
with the text inside the cell selected. Press Enter or F2 to unselect the
text and move the cursor to the end of the cell. Once the cell is in edit
mode, you can type your changes or right-click to have access to
Undo, Cut, Copy, Paste, Delete, and Select All commands from the context menu.
Press ESC to cancel changes before leaving the row.
To process the update in the database, Teratrax Database Manager searches
for a unique index or primary key to uniquely identify the row in order to
run the update against the database. If a unique index or primary key is
not found, Teratrax Database Manager uses all columns in the table to
uniquely identify the row. If there are other rows that are identical based
on all columns (possible if table does not have a primary key or unique
index), the update will fail with the following error message:
"Key column information is insufficient or incorrect. Too many rows were
affected by update."
Column Width
You have complete flexibility with the size of columns in the grid.
Initially, Teratrax Database Manager defaults the width of all columns in
the grid to 110 pixels. Drag the edge of the column to resize it. If you
resize columns, Teratrax Database Manager will save the new column size the
next time you run a query.
Grid Behavior with text, ntext, timestamp,
varbinary, image, bit, and uniqueidentifier
Columns of data type text, ntext, timestamp, varbinary,
and image are not displayed in the grid. Instead, an indicator (for example,
MEMO) is displayed. Use the CONVERT function to display the underlying
values for these data types. The following explains the various grid
indicators:
- Columns of type text and ntext
are displayed in the grid as either "Memo" if the cell does not have data
in it or "MEMO" if it contains a value.
- Columns of type timestamp are displayed
in the grid as either "Byte" if the cell does not have data in it or
"BYTE" if it contains a value.
- Columns of type varbinary are displayed
in the grid as either "VarBytes" if the cell does not have data in it or "VARBYTES"
if it contains a value.
- Columns of type image are displayed in
the grid as either "Blob" if the cell does not have data in it or "BLOB"
if it contains a value.
Columns of type bit will display "True" for 1 and "False" for 0.
To edit these cells, Type "True" or "T" for 1 and "False" or "F" for 0. The
values in the database will still be saved as 1 and 0.
Columns of type uniqueidentifier will be displayed with the actual
value. To edit these cells, Type a uniqueidentifier value (for example,
{A9AEC7AB-88A5-41A0-9684-8A79ECD64547}).
When you save grid results, the underlying values (not the indicator)
will be saved in the CSV, or HTML files.
|