Recalling and reissuing commands

Use the ? command to recall and reissue a command from the command history.

Syntax

? n | ??

Parameter

Examples

In this sample command history used for examples 1 and 2, [1] tags the oldest command issued and [3] tags the most recent command issued:

[1] select @@version
[2] select db_name
[3] select @@servername

Example 1 Recalls the command labeled 1 from the command history:

1> ? 1
1> select @@version
2>

Example 2 Recalls the latest issued command from the command history:

1> ? -1
1> select @@servername
2>

Usage