DECLARE @i AS INT; SET @i = 10; GO
或者
DECLARE @i AS INT = 10; GO
表表达式形式
DECLARE @empname AS NVARCHAR(31); SET @empname = (SELECT firstname + N' ' + lastname FROM HR.Employees WHERE mgrid = 2); SELECT @empname AS empname; GO
DECLARE @i AS INT; SET @i = 10; GO
或者
DECLARE @i AS INT = 10; GO
表表达式形式
DECLARE @empname AS NVARCHAR(31); SET @empname = (SELECT firstname + N' ' + lastname FROM HR.Employees WHERE mgrid = 2); SELECT @empname AS empname; GO