Skip to content

Declare

Andrey Gershun edited this page May 27, 2015 · 4 revisions

DECLARE

Syntax:

    DECLARE variable type [= expression]

AlaSQL allows to create local variables with @ prefix:

    var res = alasql('DECLARE @one char(3) = "abcdef"; SELECT VALUE @one')[1];
    // returns "abcdef"

Try this example in jsFiddle.

Extended syntax

You can assign value immediatly to the declared variable:

     DECLARE @var1 type1 = expr1, @var2 type2;

See also: SET

Clone this wiki locally