document updated 2 days ago, on Feb 18, 2025
SQL Workbench/J
================================================================================
Is there a way to 'grep' through all of the SQL queries that you've written,
across all workspaces?
================================================================================
Yes. Look at this file:
C:\Users\myself\.sqlworkbench\Default.wksp
That's a ZIP file. If you unzip it, you see files named this:
WbStatements1.txt
WbStatements2.txt
WbStatements3.txt
WbStatements4.txt
WbStatements5.txt
...
Each file contains the SQL statements for one tab.
----------------------
if you're using Cygwin
----------------------
In reality, each .txt file contains multiple copies of the same set of SQL statements. So it might
be more convenient to do this:
$ mkdir -p /tmp/sqlworkbenchj/; cd /tmp/sqlworkbenchj/; \rm * 2> /dev/null
$ unzip $( cygpath -u "$USERPROFILE\\.sqlworkbench\\Default.wksp" ) 'WbStatements*.txt'; rename ".txt" ".sql" *.txt
$ vim *.sql
And then use :next and :prev within Vim to navigate between them.