前言
上一節(jié)我們講解了數(shù)據(jù)類型以及字符串中幾個(gè)需要注意的地方,這節(jié)我們繼續(xù)講講字符串行數(shù)同時(shí)也講其他內(nèi)容和穿插的內(nèi)容,簡(jiǎn)短的內(nèi)容,深入的講解,Always to review the basics。
分頁(yè)方式
在SQL 2005或者SQL 2008中我們是利用ROW_NUMBER開(kāi)窗函數(shù)來(lái)進(jìn)行分頁(yè)的,關(guān)于開(kāi)窗函數(shù),我們?cè)赟QL進(jìn)階中會(huì)詳細(xì)講講。如下:
USE TSQL2012 GO DECLARE @StartRow INT DECLARE @EndRow INT SET @StartRow = 31SET @EndRow = 40SELECT [address], [city], [region] FROM ( SELECT [SC].[address], [SC].[city], [SC].[region], ROW_NUMBER() OVER( ORDER BY [SC].[address], [SC].[city],[SC].[custid]) AS RowNumber FROM Sales.Customers SC) SaleCustomer WHERE RowNumber > @StartRow AND RowNumber < @EndRow ORDER BY [address], [city], [region];