Difference between revisions of "WinSQL"

From TheBeard Science Project Wiki
Jump to: navigation, search
(Easier Query Termination)
(Easier Query Termination)
Line 4: Line 4:
 
I used to use a program called SqlDbx, which is free but it's only 32-bit unless you pay $300 for the paid version. When my workplace moved to Windows 10, I could no longer install the 32-bit Informix ODBC drivers, and I could no longer use SqlDbx with Informix.
 
I used to use a program called SqlDbx, which is free but it's only 32-bit unless you pay $300 for the paid version. When my workplace moved to Windows 10, I could no longer install the 32-bit Informix ODBC drivers, and I could no longer use SqlDbx with Informix.
  
Moving over to WinSQL, I discovered a difference that annoyed me. In SqlDbx, I would write a sequence of queries that create temp tables, like:
+
Moving over to WinSQL, I discovered a difference that annoyed me. In SqlDbx, I would write a sequence of queries that create temp tables, like this simplified example:
 
<source lang="sql">
 
<source lang="sql">
 
select id,
 
select id,

Revision as of 19:47, 12 February 2020

Easier Query Termination

I used to use a program called SqlDbx, which is free but it's only 32-bit unless you pay $300 for the paid version. When my workplace moved to Windows 10, I could no longer install the 32-bit Informix ODBC drivers, and I could no longer use SqlDbx with Informix.

Moving over to WinSQL, I discovered a difference that annoyed me. In SqlDbx, I would write a sequence of queries that create temp tables, like this simplified example:

select id,
       name,
       sex
  from employees
 where sex = "F"
  into temp employees_female with no log;

select id,
       name,
       sex
  from employees_female
 where name[0] = "A";

In SqlDbx, I could just run this whole thing, it runs the first query and creates the temp table, then the second query could select from the temp table. In WinSQL, it says the table "employees_female" is not in the database. It wasn't treating these as separate queries.

I discovered a simple solution:

  1. Go to the Edit menu and click Options.
  2. Under the General tab, there is a text field in the right pane called "Query terminator string". By default it is set to "go". Change it to ";".
  3. Uncheck the checkbox right underneath that which says "Terminators must be on a new line". Now click Ok.

The apparently want you to write "go" on a new line between every query. Nah! With this configuration change, the above query now runs without issue.