Tuesday, March 17, 2015
T-SQL variables allows you to store and assign values in your T-SQL code. Variables is a storage unit in programming which allows you to refer back to it at a later time.
T-SQL variables have the following characteristics:
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
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.
Convert INT Variable To String
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);
Subscribe to:
Post Comments (Atom)
Search This Blog
Tags
Web Development
Linux
Javascript
DATA
CentOS
ASPNET
SQL Server
Cloud Computing
ASP.NET Core
ASP.NET MVC
SQL
Virtualization
AWS
Database
ADO.NET
AngularJS
C#
CSS
EC2
Iaas
System Administrator
Azure
Computer Programming
JQuery
Coding
ASP.NET MVC 5
Entity Framework Core
Web Design
Infrastructure
Networking
Visual Studio
Errors
T-SQL
Ubuntu
Stored Procedures
ACME Bank
Bootstrap
Computer Networking
Entity Framework
Load Balancer
MongoDB
NoSQL
Node.js
Oracle
VirtualBox
Container
Docker
Fedora
Java
Source Control
git
ExpressJS
MySQL
NuGet
Blogger
Blogging
Bower.js
Data Science
JSON
JavaEE
Web Api
DBMS
DevOps
HTML5
MVC
SPA
Storage
github
AJAX
Big Data
Design Pattern
Eclipse IDE
Elastic IP
GIMP
Graphics Design
Heroku
Linux Mint
Postman
R
SSL
Security
Visual Studio Code
ASP.NET MVC 4
CLI
Linux Commands
Powershell
Python
Server
Software Development
Subnets
Telerik
VPC
Windows Server 2016
angular-seed
font-awesome
log4net
servlets
tomcat
AWS CloudWatch
Active Directory
Angular
Blockchain
Collections
Compatibility
Cryptocurrency
DIgital Life
DNS
Downloads
Google Blogger
Google Chrome
Google Fonts
Hadoop
IAM
KnockoutJS
LINQ
Linux Performance
Logging
Mobile-First
Open Source
Prototype
R Programming
Responsive
Route 53
S3
SELinux
Software
Unix
View
Web Forms
WildFly
XML
cshtml
githu
Đặ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