SQL Server from getting started to mastering

Source: Internet
Author: User

1. Data paging

OFFSET: Specifies the number of rows that will be skipped before rows are returned from a query expression.

FETCH: Specifies the number of rows to be returned after the offset clause.


Offset is a synonym for the leaf number, and Frtch represents the number of rows displayed per page.

Select ProductID, ProductNumber, Name as ProductName, Listpricefrom Production.productorder by Productidoffset 0 rowsfetc H Next ten rows only


2. Using variables

Declaring variables: declare @variable int

Three methods of assignment: You can use the Set keyword, which is the best choice, you can assign a value to a variable in a SELECT statement, and you can assign a value to it during the declaration of a variable.

DECLARE @variable intset @variable = <value>
Select @variable = <column or Expression>from <table name>
declare @variable int = <value>



















This article is from the "Night So Deep" blog, please be sure to keep this source http://lvhz94zm6.blog.51cto.com/9805380/1880099

SQL Server from getting started to mastering

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.