1

I'm trying to figure out how to create a variable in SQuirrel SQL that can be used in a query. Help! Just a simple piece of code would suffice. Something that would be similar to the code below.

DECLARE 
  @iVariable INT = 1, 
  @vVariable VARCHAR(100) = 'myvar', 
  @dDateTime DATETIME = GETDATE()
SELECT 
  @iVariable iVar, 
  @vVariable vVar, 
  @dDateTime dDT;

Results:

iVar = 1 
vVar = myvar 
dDT = 2018-10-18 17:18:08.073

Or something similar to this simple query.

DECLARE @Var1 VARCHAR(255) 
SET @Var1 = 'awesome'
SELECT 
  'I wish SQuirrel SQL was ' + @Var1; 

Results:

I wish SQuirrel SQL was awesome.
jondough
  • 21
  • 2
  • The last SQL you mention is processed at the server side, that is in the database engine. If you want that to work as expected, then your database server needs to be aware of. If that's the case, a maybe a [PL/pgSQL][1] function is what you need. Not sure [1]: https://www.postgresql.org/docs/current/static/plpgsql.html – The Impaler Oct 18 '18 at 21:35

0 Answers0