Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 (中文) » SQL Anywhere 服务器 - SQL 用法 » SQL 方言和兼容性

 

Transact-SQL 过程中的变量

SQL Anywhere 使用 SET 语句来向过程中的变量赋值。在 Transact-SQL 中,将使用含空表列表的 SELECT 语句或 SET 语句来赋值。下面的简单过程说明了 Transact-SQL 语法的工作原理:

CREATE PROCEDURE multiply
               @mult1 int,
               @mult2 int,
               @result int output
AS
SELECT @result = @mult1 * @mult2;

可以按如下方式来调用该过程:

CREATE VARIABLE @product int
go
EXECUTE multiply 5, 6, @product OUTPUT
go

当该过程执行后,变量 @product 的值为 30。

 另请参见