-
Notifications
You must be signed in to change notification settings - Fork 16
history
Scott C Gray edited this page Feb 26, 2017
·
1 revision
Displays a history of SQL statements executed
\history [-a]
Displays a history of SQL statements executed. For example:
1> \history
(1) select count(*) as 'Count' from $t
(2) select 1
(3) select top 3 * from sysdatases
(4) select top 3 * fromsysdatabases
(5) select top 3 * from sysdatabases
(6) use mydb
(7) select * from STATISTIC_SAMPLE_TYPE
where SAMPLE_DATE >= '1/1/2012'
(8) exec sp_myproc @x = 10
(9) sp_who
(10) select * from syscolumns
The command history displayed in chronological order with the final entry shown being the most recent statement executed.
History entries are added whenever either the \go or \reset commands are executed. See buffers for an explanation of how to work with SQL buffers.
Show all of every SQL statement executed. If this flag is not provided only the first 10 lines of any SQL statement will be displayed.
\buf-edit, \buf-copy, \buf-append, \buf-load, buffers, \go, \reset