A sequence is a database object that generates a sequence of numeric values, for example, for creating unique identifiers. Additionally, sequences are independent of any table and can be shared across multiple tables or queries.
In Database Explorer, you can perform operations on sequences by using the shortcut menu. Right-click a sequence in Database Explorer to access options for specific tasks, such as creating and managing sequences.
1. In Database Explorer, right-click a sequence or Sequences node and select New Sequence.
2. Update the CREATE SEQUENCE statement template.
3. At the bottom of the SQL document, click Apply Changes.
1. In Database Explorer, right-click the sequence and select Open Editor.
2. Edit the sequence.
3. At the bottom of the SQL document, click Apply Changes.
1. In Database Explorer, right-click the sequence you want to delete and select Delete, or press Delete.
2. Click Yes to confirm the deletion.
Note
You cannot undo the drop sequence operation, as this action permanently deletes the sequence. To avoid data loss, back up the database before deleting the sequence.
1. In Database Explorer, right-click a required sequence and select Duplicate Object.
2. In the Duplicate Object dialog, configure the object settings:
3. Click OK.
1. In Database Explorer, right-click a required sequence and select Generate Script As, then select the statement type.
2. Select one of the following output options:
For more information, see Generate the DDL and DML statements for database objects.
To view sequence properties, in Database Explorer, right-click the sequence or Sequences node and select Show Details.
Object Viewer opens and provides detailed information about the sequence.
To update the sequence to reflect the latest changes, in Database Explorer, right-click the sequence or Sequences node and select Refresh, or press F5.
To open the Properties window, in Database Explorer, right-click the sequence and select Properties, or press F4.
1. In Database Explorer, right-click the Sequences node and select Filter.
2. In the Filter Settings dialog, configure the filter parameters.
3. Click OK to apply the filter.
Note
When you open the Sequences node, the number of objects it contains appears in parentheses next to the node name. This number changes based on your filter settings.
The following table describes the shortcut menu options, which appear when you right-click a specific sequence in Database Explorer.
| Name | Description |
|---|---|
| New Sequence | Opens a CREATE SEQUENCE template in a new SQL document to create a new sequence. |
| Open Editor | Opens the selected sequence in a new SQL document containing a CREATE SEQUENCE statement to create the sequence or change its code. |
| Source Control > Source Control Manager | Opens Source Control Manager, where you can track and manage changes to database schema and static data. When Source Control Manager is already open, this option refreshes it. |
| Source Control > Commit | Opens Source Control Manager with all local changes (if any) selected and ready to commit. When Source Control Manager is already open, this option refreshes it and selects all local database changes. |
| Source Control > Get Latest | Opens Source Control Manager with all remote changes (if any) selected, ready to pull using Get Latest. When Source Control Manager is already open, this option refreshes it and selects all remote database changes. |
| Duplicate Object | Opens the Duplicate Object dialog to duplicate the object. |
| Generate Script As | Generates a script of the selected object using the CREATE, DROP, and DROP and CREATE statements. The script can be saved to a new SQL document or to a file, or copied to the clipboard. |
| Show Details | Opens Object Viewer that displays object details. |
| Delete | Drops the selected object from the database. Shortcut: Delete |
| Refresh | Updates the object to reflect the latest changes. Shortcut: F5 |
| Properties | Opens the Properties pane to view the object information. Shortcut: F4 |
The following table describes the shortcut menu options, which appear when you right-click the Sequences node in Database Explorer.
| Name | Description |
|---|---|
| New Sequence | Opens a new SQL document containing the CREATE SEQUENCE statement template. |
| Source Control > Source Control Manager | Opens Source Control Manager, where you can track and manage changes to database schema and static data. When Source Control Manager is already open, this option refreshes it. |
| Source Control > Commit | Opens Source Control Manager with all local changes (if any) selected and ready to commit. When Source Control Manager is already open, this option refreshes it and selects all local database changes. |
| Source Control > Get Latest | Opens Source Control Manager with all remote changes (if any) selected, ready to pull using Get Latest. When Source Control Manager is already open, this option refreshes it and selects all remote database changes. |
| Filter | Opens the Filter Settings dialog to control which sequences should appear in Database Explorer. |
| Show Details | Opens Object Viewer that displays object details. |
| Refresh | Updates the object to reflect the latest changes. Shortcut: F5 |
Note
The Source Control shortcut menu is available only after you link the corresponding database to a source-control system.
In Database Explorer, hold down Ctrl and select multiple sequences. Then right-click the selection and select the required option.
The following table describes the shortcut menu options available for multiple sequences.
| Name | Description |
|---|---|
| Open Editor | Opens the Sequence designer for each selected sequence to create the sequence or change its code. |
| Source Control > Source Control Manager | Opens Source Control Manager, where you can track and manage changes to database schema and static data. When Source Control Manager is already open, this option refreshes it. |
| Source Control > Commit | Opens Source Control Manager with all local changes (if any) selected and ready to commit. When Source Control Manager is already open, this option refreshes it and selects all local database changes. |
| Source Control > Get Latest | Opens Source Control Manager with all remote changes (if any) selected, ready to pull using Get Latest. When Source Control Manager is already open, this option refreshes it and selects all remote database changes. |
| Source Control > Link/Unlink Static Data | Opens the Source Control Link Static Data dialog that displays the tables whose data you want to link. |
| Generate Script As | Generates scripts of the selected objects using the CREATE, DROP, and DROP and CREATE statements. The scripts can be generated to a new SQL document or to a file, or copied to the clipboard. |
| Delete | Drops the selected sequences from the database. Shortcut: Delete |
