Declaring and Initializing Multiple Variables
Initializing a variable at declaration time was not possible in SQL 2k5. But this functionality is now available in Sql Server 2k8. We can declare and initialize variables with any constant value or with any expression;
DECLARE
@a int = 777,
@b bit = 0,
@c VARCHAR (10) = 'trg tech',
@d CHAR (3) = Substring('trg tech', 1, 3)
PRINT @a
PRINT @b
PRINT @c
PRINT @d
They indeed are making our lives easy!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment