ODBC Server Reference Manual
Transact-SQL Language
HP NonStop ODBC Server Reference Manual—429151-002
4-26
Variables
Variables
You can use both local and global variables when using the NonStop ODBC Server.
Local variables, however, have some usage restrictions, and not all global variables
are supported. Also, you cannot declare values for global variables.
This subsection contains information on both local and global variables.
Local Variables
You can use local variables when using the NonStop ODBC Server, naming the
variables according to Transact-SQL naming rules. Using variables in the NonStop
ODBC Server, however, differs from using them in Transact-SQL in the following ways.
Referencing Null Variables
A variable cannot be null when it is referenced. For example, the following statements
will result in an error:
declare @v1 int, @v2 int
select @v2 = @v1
Nonaggregate and Aggregate Assignments to Variables
Variable assignments cannot contain a mix of nonaggregate and aggregates. For
example, the following statement is not allowed:
select @v1 = c1, @v2 = max (c2) from t1
An alternative is to divide the statement into two statements:
select @v1 = c1 from t1
select @v2 = max (c2) from t1
For more information, see the following documents:
Global Variables
You can use Transact-SQL global variables when using the NonStop ODBC Server;
however, not all global variables are supported.
Table 4-9 summarizes the global variables and whether they are supported by the
NonStop ODBC Server.
For Information On See
Declaring variables DECLARE
on page 4-61.
Assigning values to variables SELECT
on page 4-82.
Using variables in
Transact-SQL
Microsoft SQL Server Transact-SQL Reference