我试图弄清楚如何在SQuirrel SQL中创建可在查询中使用的变量。救命!仅需一段简单的代码就足够了。类似于下面的代码。
DECLARE
@iVariable INT = 1,
@vVariable VARCHAR(100) = 'myvar',
@dDateTime DATETIME = GETDATE()
SELECT
@iVariable iVar,
@vVariable vVar,
@dDateTime dDT;
结果:
iVar = 1
vVar = myvar
dDT = 2018-10-18 17:18:08.073
或类似此简单查询的内容。
DECLARE @Var1 VARCHAR(255)
SET @Var1 = 'awesome'
SELECT
'I wish SQuirrel SQL was ' + @Var1;
结果:
I wish SQuirrel SQL was awesome.