sql ·ÖÒ³Óï¾ä
1. select top pageSize
* from table where id not in(select top((pageNo-1)*pageSize
) id from table order by id asc)
2. select * from table where id<=pageSize*pageNo
and id>(pageNo-1)*pageSize
order by id asc
×¢£º
pagesizeÿҳÏÔʾµÄ¼Ç¼Êý
pageNoµ±Ç°µÚ¼¸Ò³
Ïà¹ØÎĵµ£º
Àý1 ´«ÈëÒ»¸ö²ÎÊý@username,ÅжÏÓû§ÊÇ·ñ´æÔÚ
-------------------------------------------------------------------------------
CREATE PROC IsExistUser
(
@username varchar(20),
@IsExistTheUser varchar(25) OUTPUT--Êä³ö²ÎÊý
)
as
SELECT @IsExistTheUser = count(username)
from users
WHERE username ......
ʾÀý
A. ʹÓôøÓи´ÔÓ SELECT Óï¾äµÄ¼òµ¥¹ý³Ì
ÏÂÃæµÄ´æ´¢¹ý³Ì´ÓËĸö±íµÄÁª½ÓÖзµ»ØËùÓÐ×÷Õߣ¨ÌṩÁËÐÕÃû£©¡¢³ö°æµÄÊé¼®ÒÔ¼°³ö°æÉç¡£¸Ã´æ´¢¹ý³Ì²»Ê¹ÓÃÈκβÎÊý¡£
USE pubs
IF EXISTS (SELECT name from sysobjects
WHERE name = 'au_info_all' AND type = 'P')
&nb ......
½ñÌì³é³öÒ»µãʱ¼ä½âÊͼ¸¸ö¹ØÓÚSQLÈÕÖ¾µÄ¸ÅÄËûÃÇÒ²¾³£Ê¹³õѧÕßÍû¶øÖ¹²½£¬·´Õý¼ÆËã»úµÄÊõÓﶼÊǺܳéÏóµÄ£¬ËùÒÔµÚÒ»¸Ð¾õ¾ÍÊÇÍ·ÌÛ£¬È»ºóÈ»ºó¼¸´Îºó¾Íû¸Ð¾õÁË.ÒÔÏÂÓÐЩÊÇ´ÓÊéÉÏÕª³µÄ,ÓеÄÊÇ´ÓÍøÉÏÕÒµÄËãÊǽ軨Ï×·ð°É!!
¡¡¡¡ÎïÀíÈÕÖ¾Îļþ£º
Õâ¸ö±È½ÏºÃÀí½â£¬ÊµÊµÔÚÔڵĶ«Î÷£¬Êý¾Ý¿âĿ¼ÏÂÃæµÄ.ldfÎļþ ......
½ñÌì²âÊÔwebÏîĿн¨ÁËÒ»¸öÊý¾Ý¿â£¬½á¹û±¨´í,ÒÔÇ°µÇ¼ֱ½ÓÑ¡Ôñ'WindowsÉí·ÝÑéÖ¤',²¢Ã»ÓÐʲôÎÊÌâ³öÏÖ!¿ÉÇ°¶Îʱ¼ä²ÉÓÃ'SQLSERVERÉí·ÝÑéÖ¤'È¥µÇ¼,ËæÖ®µÄÎÊÌâ¾ÍÀ´ÁË.ÎÞÂÛÓÃʲô·½·¨¾ÍÊÇÒ»¸ö½á¹û³ö´í! ³ö´íµÄÔÒòÊÇ:'Óû§ 'sa' µÇ¼ʧ°Ü¡£¸ÃÓû§Óë¿ÉÐÅ SQL Server Á¬½ÓÎÞ¹ØÁª'.½ñÌìÉÏÍøÉϲéÁË°ëÌ컹ÊǸ㲻¶¨,×îºó¾¹ýÍøÉϺÍÊéÉ ......