How to get a previously run SQL in Aginity

Every once and a while, it happens that a SQL needs to be reused, but for whatever reason it was not saved.  If it wasn’t too far back in time, you can recover the SQL from the User Query History.  This is a fairly straight forward process, if not exactly obvious.

The basic process is:

  • Connect to the database
  • Navigate to View > User Query History
Aginity View User Query History

Aginity View User Query History

  • Select the SQL Statement you want to retrieve

note: you want to select a databases and or user to narrow you rows returned.

  • Right Click to display command menu
Copy SQL Statement from Aginity User Query History

Copy SQL Statement from Aginity User Query History

  • Select ‘Copy SQL Statement’
  • Now you can paste the SQL in any Aginity Query Tab of your choosing