Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Ò»¸ösql·ÖÒ³µÄ´æ´¢¹ý³Ì

 CREATE  procedure SqlPager_Ex
 @sqlstr varchar(8000), --²éѯ×Ö·û´®
  @currentpage int, --µÚNÒ³
  @pagesize int --ÿҳÐÐÊý, 
 as
  set nocount on
  declare @P1 int, --P1ÊÇÓαêµÄid
   @rowcount int
  exec sp_cursoropen @P1 output,@sqlstr,@scrollopt=1,@ccopt=1,@rowcount=@rowcount output
  select  ceiling(1.0*@rowcount /@pagesize)  as ×ÜÒ³Êý --,@rowcount as ×ÜÐÐÊý,@currentpage as µ±Ç°Ò³  
  set @currentpage=(@currentpage-1)*@pagesize+1
  exec sp_cursorfetch @P1,16,@currentpage,@pagesize
  exec sp_cursorclose @P1
  set nocount off
GO


Ïà¹ØÎĵµ£º

1.The SQL introuduction

Introducing Oracle Database 11g
List the features of Oracle Database 11g
Discuss the basic design, theoretical and physical aspects of a relational database
Categorize the different types of SQL statements
Describe the data set used by the course
Log onto the database using the SQL Develope ......

sql 2005 ·ÖÒ³£¬ÅÅÃûº¯Êý

 WITH V AS(SELECT ROW_NUMBER() OVER(order by fcustid desc) AS RN,*  from  ts_dict AS SourceView)
SELECT * from V WHERE RN BETWEEN 1 AND 10
תÔصØÖ·£ºhttp://www.cnblogs.com/nokiaguy/archive/2009/02/05/1384860.html
ÅÅÃûº¯ÊýÊÇSQL Server2005мӵŦÄÜ¡£ÔÚSQL Server2005ÖÐÓÐÈçÏÂËĸöÅÅÃûº ......

²é¿´sql server 2000µÄ°æ±¾µÄÈýÖÖ·½·¨

·½·¨Ò»£º
´ò¿ªÆóÒµ¹ÜÀíÆ÷£­>SQL SERVRE ×飭>(local)window NT ->ÊôÐÔ
²úÆ·:ÓÐpersonalµÄÊǸöÈË°æµÄ£¬ÓÐEnterpriseµÄÊÇÆóÒµ°æµÄ
²úÆ·°æ±¾£º8.00.2039(sp4);8.00.760(sp3)
·½·¨¶þ£º
µÚÒ»²½£ºÔÚ²éѯ·ÖÎöÆ÷
select @@version
print @@version
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 ......

SQL Server2005ËĸöÅÅÐòº¯Êý¼ò½é

ÅÅÃûº¯ÊýÊÇSQL Server2005мӵŦÄÜ¡£ÔÚSQL Server2005ÖÐÓÐÈçÏÂËĸöÅÅÃûº¯Êý£º
1. row_number ×Ô¶¯Éú³ÉÐкÅ,ÐòºÅÓÉorder by ×ֶξö¶¨
2. rank over Filed, ÓÉrank overµÄ×ֶξö¶¨£¬Ãû´Î²»Á¬Ðø£¬ÈçÓÐ3¸ö²¢ÁеÚÒ»Ãû£¬ÔòºóÐøÃû´ÎÖ±½Ó´Ó4¿ªÊ¼
3. dense_rank£¬ºÍrankÏàËÆ£¬Ö»ÊÇÃû´ÎÁ¬Ðø£¬ÈçÓÐ3¸ö²¢ÁеÚÒ»Ãû£ ......

SQL SERVERÈÕÆÚʱ¼äº¯Êý

 À´Ô´http://hi.baidu.com/smilevt/blog/item/04bddeef0fe3f42e2cf5348b.htmlÕâÀﻹÓкܶàsql serverµÄÌû×Ó
1. µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
select getdate()
2. dateadd ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
ÀýÈ磺ÏòÈÕÆÚ¼ÓÉÏ2Ìì
select dateadd(day,2,'2004-10-15') --·µ»Ø£º2004-10-17 00:00:00. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ