i found that its possible and thought to post this to my blog.
Method 1: Multiple statements for declaring multiple variables
DECLARE @Var1 INT
DECLARE @Var2 INT
SET @Var1 = 1
SET @Var2 = 2
SELECT @Var1 ‘Var1′, @Var2 ‘Var2′
Method 2: Single statements for declaring multiple variables
DECLARE @Var1 INT, @Var2 INT
SET @Var1 = 1
SET @Var2 = 2
SELECT @Var1 ‘Var1′, @Var2 ‘Var2′
GO
From above example its clear that we can declare multiple variables in one statements.
No comments:
Post a Comment