°ïÐÄÓÅ»¯Ò»ÏÂsql - MS-SQL Server / »ù´¡Àà
declare @sql=N'SELECT TOP '+cast(@pageSize as varchar(50))+' * from (SELECT TOP ' +cast(@pageSize*@currentpage as varchar(50))+' * from [InMail] A ORDER BY A.id DESC) B ORDER BY B.id ASC' set @sql='SELECT from ('+@sql+') C ORDER BY C.id DESC' ÏÈÊÇ·ÖÃæ¡£µ«ÊǺóÃæÓÖ³öÀ´ÁËÅÅÐò²»ÕýÈ·ÁË¡£ Èç 1 2 3 4 5 6 7 8 9 ÏÂÃæÊÇ×îеġ£ÒªÏÔÊÇÔÚ×îÉÏÃæ Èç¹ûpageSize=2 currentPage=2 ÔòÒªÇóÈ¡³ö 7 6 ---------- pageSize=2 currentPage=3 5 4
²»ºÃÒâ˼£¬±êÌâ´ò´íÁË¡£ÒýÓà SQL code --> Éú³É²âÊÔÊý¾Ý±í: [InMail] IF OBJECT_ID('[InMail]') IS NOT NULL DROP TABLE [InMail] GO CREATE TABLE [InMail] ([ID] [int]) INSERT INTO [InMail] SELECT '1' UNION ALL SELECT '2' UNION ALL¡¡ ÓÐûÓпÉÒÔÓÅ»¯Ò»Ïµģ¿ ÎÒ¿¿£¬ÏÂÃæµÄʲôÌù×ÓŶ¡£°ÑÎÒÎÊÌⶼ¸ø¸ÇÏÂÈ¥ÁË¡£ÒýÓà ÎÒ¿¿£¬ÏÂÃæµÄʲôÌù×ÓŶ¡£°ÑÎÒÎÊÌⶼ¸ø¸ÇÏÂÈ¥ÁË¡£ ÄãÊÇʲô°æ±¾µÄÊý¾Ý¿â£¿ÒýÓà ÒýÓà 4 Â¥ jinfengyiye µÄ»Ø¸´: ÎÒ¿¿£¬ÏÂÃæµÄʲôÌù×ÓŶ¡£°ÑÎÒÎÊÌⶼ¸ø¸ÇÏÂÈ¥ÁË¡£ ÄãÊÇʲô°æ±¾µÄÊý¾Ý¿â£¿ Õâ¸ö²»ÊÇ£¬ÎÒÊÇ˵csdnÀïµÄÌù×Ó£¬ÄÇЩXXÌù£¬°ÑÎÒµÄÌù×Ó¸ÇÏÂÈ¥ÁË¡£ SQL code Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighl
Ïà¹ØÎÊ´ð£º
ÈçºÎÔÚSQL2005ÖÐÉ趨¶¨Ê±×÷Òµ£¬±ÈÈç˵¶¨Ê±ÇåÀíijЩ±íµÄÊý¾Ý£¬ »òÕßÊǶ¨Ê±µÄ½«Ä³Ð©±íµÄÊý¾Ýµ¼³öexcel£¡ ÔÚÏߵȴý£¬¼±¼±¼±£¬×îºÃÊÇÏêϸ²½Ö裡 ֮ǰÎÒ×öµÄ×÷ÒµÓеãÎÊÌ⣡ °ïUP ²Î¿¼:http://hi.baidu.com/toiota ......
ÏÖÔÚÓÐÒ»¸ö²¿Ãűídept£¨²¿ÃÅÃû³Æ£¬²¿Ãźš£¡££©ÓÐÒ»¸öÈËÔ±±íemp£¨ÐÕÃû£¬ÈËÔ±±àºÅ£¬Ö°Î»£¬Ð½×Ê£¬²¿ÃÅ£© emp±íÖеÄÄÚÈÝÊÇÕâÑùµÄ£º a 1 ¹¤³Ìʦ 3000 Èí¼þ²¿ b 2 ÆÕͨԱ¹¤ 2000 Ó²¼þ²¿ c 3 ¹¤³Ìʦ 4000 Ó²¼þ²¿ d ......
Ôõô°ÑMDFÊý¾Ýתµ½MySQL£¿ ÖÁÉٵø½¼Óµ½sqlserverÉÏ ¾ßÌåÔõôŪ°¡ ÎҵıÏÒµÉè¼ÆµÄÊý¾Ý¿âÊÇ´ÓÍøÉÏdownÏÂÀ´µÄ£¿£¿ Ä㻹²»ÈçÖ±½ÓÓÃsqlserverÄØ º¯Êý¡¢´æ´¢¹ý³Ì¶¼µÃ¸ÄÁË¡£ sqlserverûÔõôÓùý¡£Ò²Ã»Óа²× ......
¸÷λºÃ£¬ÎÒ¸Õ°ÑÒ»¸öASPÍøÕ¾ÉèÖúÃÁË£¬Ò²ÄÜÕý³£·ÃÎÊ¡£µ«ÊÇÔÚÎÒ±¾»úÉϲ»ÄÜ´ò¿ªadmin\login.asp,ËùÒÔÎÞ·¨ÊµÏÖºǫ́¹ÜÀí¡££¨´íÎóÌáʾÎÞ·¨ÕÒµ½ÍøÒ³£¬´úÂë404£¬ÎҵIJÙ×÷ϵͳÊÇwin2000 server) µ«ÊÇÆæ¹ÖµÄÊÇÔÚ¾ÖÓòÍøµÄÆäËû» ......