T-SQL variables have the following characteristics:
- Local variables must be prefixed @
- Global variables must be prefixed with @@
- Must be declared with the DECLARE statement
- Must specify the data type when declared
DECLARE @employeeID INT; DECLARE @firstName CHAR(10), @lastName CHAR(20);
As you can see from the above example you can declare a single variable or declare multiple variables with a comma separated list.
Setting variables
SET @employeeID = 1; SET @firstName='Davolio'; SET @lastName='Nancy';
The above example uses the SET statement assign values to the variables one at a time.
To assign values to multiple variables with one statement you can use the SELECT statement.
SELECT @employeeID=1,@firstName='Dovolio',@lastName='Nancy';
Convert INT Variable To String
Convert(CHAR,@employeeID);
Đặt vé tại phòng vé Aivivu, tham khảo
ReplyDeletegiá vé máy bay đi Mỹ khứ hồi
ve may bay từ mỹ về việt nam hãng eva
thông tin chuyến bay từ canada về việt nam
lịch bay từ nhật về việt nam hôm nay
Chuyến bay từ Hàn Quốc về Việt Nam
Vé máy bay từ Đài Loan về VN
chuyen bay chuyen gia ve viet nam