1 overview
This article provides a brief analysis of the basic usage of as in SQL Server.
2 Specific analysis
2.1 Defining variable Types
1 DECLARE @UserName as VARCHAR (+) = ' alan_beijing '
2.2 Take aliases
2.2.1 Alias for result set column
Code
1 SELECT orderid,custid,orderdate 2 from
Result
Code
1 SELECT as ' Order ID ' as ' Customer ID ' as ' Order Date ' 2 from
Result
2.2.2 Aliases for tables
1 SELECT o.orderid,o.custid,o.orderdate 2 from as O
2.2.3 Aliases for subqueries
1 SELECT childquery_orders.orderdate 2 from 3 (SELECT*4 from Orders 5 WHERE CustID>=5 as Childquery_orders
2.3 Conversion Type
2.3.1 Cast type conversion
1 SELECT CAST ('+'asINT) -- the
2.3.2 Convert type Conversion
1 SELECT CONVERT (decimal'123.6'--
2.4 Creating a view that represents the base table source
1 CREATE VIEW 2as3SELECT* from Orders
2.5 Other (subsequent additions)
3 references
"01" Microsoft SQL Server 2008 Insider: T-SQL language Basics
"02" Microsoft SQL Server 2008 Tech Insider: T-SQL query
4 Copyrights
- Thank you for your reading, if there are shortcomings, welcome advice, common learning and common progress.
- Bo main website: http://www.cnblogs.com/wangjiming/.
- A very small number of articles using reading, reference, reference, copying, copying and pasting into a variety of ways, most of the original.
- If you like, please recommend, if you have new ideas, welcome, email: [Email protected].
- The blog can be reproduced, but must be well-known from the blog source.
Usage of "SQL Server series" as