Inserting rows into the database from the Interactive SQL result set

Interactive SQL allows you to add new rows to a table. You tab between columns in the result set to add values to the row. You must have INSERT permission on the table to add new rows.

To insert a new row into the result set

  1. Right-click the result set and choose Add Row.

    A new blank row appears with a blinking cursor in the first value in the row.

  2. Enter the new value and then press Tab to move to the next column.

    You cannot enter invalid data types into a column. For example, you cannot enter a string into a column that accepts the INT data type.

    Repeat this step until all the column values are added.

  3. Press Enter to update the database.

Inserting values into columns with default values

When adding a value in a column that has a default value, the cell editor contains a list with a (DEFAULT) item. Select (DEFAULT) if you want to insert the default value. Similarly, if a column accepts NULL values, (NULL) appears in the list. If a column cannot be NULL and does not have a default value, you must enter a value.

Inserting values into computed columns

If the result set contains a computed column and you do not specify a value for the computed column, the value is calculated when the database is updated. However, if you specify a value for the computed column, the database is updated with the specified value, and a value is not calculated for the computed column.

Inserting new rows using the INPUT statement

An alternative to inserting new rows from the result set in Interactive SQL is to add rows using the INPUT statement with the PROMPT clause. When the PROMPT clause is specified, Interactive SQL prompts you for the value for each column in the table. For example, to add a new row to the Products table and be prompted for the values for each column, you would execute the following statement in Interactive SQL:

INPUT INTO Products PROMPT;