ʵÏÖsqlserver·ÖÒ³²éѯÓï¾ä
sqlServer£º
Ò»´Î²éѯ£¬Êý¾Ý¿âÖ»·µ»ØÒ»Ò³µÄÊý¾Ý¡£¶ø²»ÊÇÈ¡³öËùÓеÄÊý¾Ý¡£
pagesize£º ÿҳÏÔʾ¼Ç¼Êý
cureentpage£ºµ±Ç°Ò³Êý
select * from ( select TOP pagesize * from ( SELECT TOP pagesize*cureentpage * from my_table ORDER BY id ASC ) as amyTable ORDER BY id DESC ) as bmyTable ORDER BY id ASC
¼ÙÉè¹²ÓÐÓÐ8Ìõ¼Ç¼£¬Ã¿Ò³ÏÔʾ3Ìõ¼Ç¼£¬id Ϊ3£¬6£¬7£¬37
µÚÒ»Ò³£¨Ê×Ò³£©
select * from ( select TOP 3 * from ( SELECT TOP 3*1 * from my_table ORDER BY id ASC ) as amyTable ORDER BY id DESC ) as bmyTable ORDER BY id ASC
µÚ¶þÒ³
select * from ( select TOP 3 * from ( SELECT TOP 3*2 * from my_table ORDER BY id ASC ) as amyTable ORDER BY id DESC ) as bmyTable ORDER BY id ASC
µÚÈýÒ³£¨Î²Ò³£©
select * from ( select TOP 8-2*3 * from ( SELECT TOP 8-3*2 * from my_table ORDER BY id ASC ) as amyTable ORDER BY id DESC ) as bmyTable ORDER BY id ASC
Ïà¹ØÎĵµ£º
**ÔÚsqlserverÖÐÈç¹ûҪʹÓÃÒ»¸ö³ÌÐò¼¯Ò»°ãÓÐÈçÏÂ×¢ÒâÊÂÏî
Ò»£º´ò¿ªsqlserver µÄCLRÖ§³Ö
&nb ......
import pymssql
#connect database
conn=pymssql.connect(host="192.168.1.28",user="boomink",password="boomink",
database="boomink")
cur=conn.cursor()
print '========================================'
cur.execute("exec Orders_GetTest1 @Valu ......
дÁËÒ»¸ö´æ´¢¹ý³Ì¶ÔÊÓͼ½øÐзÖÒ³²éѯ£¬µ«Êý¾ÝÔö¶àºó·¢ÏÖ»ùЧÂʵ͵ÃÒªÃü£¬ÈýÍò¶àÌõÊý¾ÝÒª²éѯһ¸ö°ëСʱ¶¼Ã»³öÀ´£¬Õâ²»ÊÇÒªÁËÃü£¬ÓÚÊÇÏëµ½ÁËË÷Òý£¬Ó¦ÓùýºóÈÔÎÞ¼ÃÓÚÊ¡£×îºó¶Ôsql½øÐзÖÎöºÍʵ¼ùÖеóö£¬Ê¹ÓÃÁÙʱ±í¿ÉÒÔ´ó´ó¼Ó¿ìÊÓͼµÄ²éѯËٶȣ¬¼ûÈçÏÂsqlÓï¾ä
ÐÔÄܳ¬µÍµÄÊÓͼ·ÖÒ³sqlÓï¾ä£º
select top 100 * from
view_c ......
µÚÒ»ÖÖ JavaScriptÁ¬½ÓÊý¾Ý¿â£º
<mce:script language="JavaScript"><!--
// ´´½¨Êý¾Ý¿â¶ÔÏó
var objdbConn = new ActiveXObject("ADODB.Connection");
// DSN×Ö·û´®
var strdsn = "Driver={SQL Server};SERVER=192.168.0.210;UID=xhb;PWD=xhb;DATABASE=books";
// ´ò¿ªÊý¾ÝÔ´
objdbConn.Open(strdsn);
// ......
Ë÷ÒýµÄÖØÒªÐÔ
Êý¾Ý¿âÐÔÄÜÓÅ»¯ÖÐË÷Òý¾ø¶ÔÊÇÒ»¸öÖØÁ¿¼¶µÄÒòËØ£¬¿ÉÒÔ˵£¬Ë÷ÒýʹÓò»µ±£¬ÆäËüÓÅ»¯´ëÊ©½«ºÁÎÞÒâÒå¡£
¾Û´ØË÷Òý
(Clustered Index)ºÍ·Ç¾Û´ØË÷Òý
(Non- Clustered Index)
×îͨË׵ĽâÊÍÊÇ:¾Û´ØË÷ÒýµÄ˳Ðò¾ÍÊÇÊý¾ÝµÄÎïÀí´æ´¢Ë³Ðò£¬¶ø¶Ô·Ç¾Û´ØË÷ÒýµÄË÷Òý˳ÐòÓëÊý¾ÝÎïÀíÅÅÁÐ˳ÐòÎ޹ء£¾ÙÀýÀ´Ëµ£¬Äã·µ½Ð»ª×ÖµäµÄº ......