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µ±Ç°µÚ¼¸Ò³
Ïà¹ØÎĵµ£º
select * from orders where month(orderdate)= (select month(orderdate) from orders where orderid=10248)
1.Ò»¸öÔµÚÒ»ÌìµÄ
Select DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
2.±¾ÖܵÄÐÇÆÚÒ»
Select DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)
3.Ò»ÄêµÄµÚÒ»Ìì
Select DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
......
Àý1 ´«ÈëÒ»¸ö²ÎÊý@username,ÅжÏÓû§ÊÇ·ñ´æÔÚ
-------------------------------------------------------------------------------
CREATE PROC IsExistUser
(
@username varchar(20),
@IsExistTheUser varchar(25) OUTPUT--Êä³ö²ÎÊý
)
as
SELECT @IsExistTheUser = count(username)
from users
WHERE username ......
Update Channel set Unit ='mg' ,
RunUpThreshold='10' ,
RunDownThreshold='10' ,
SafetyUpThreshold='10' ,
SafetyDownThreshold='10'
where Bridge='001' and DeviceCode='AS'
and SensorCode='001' and Supplement='N'
set £º ','
where: and ......
ÈôÒªÊÕËõÌض¨Êý¾Ý¿âµÄËùÓÐÊý¾ÝºÍÈÕÖ¾Îļþ£¬ÇëÖ´ÐÐ DBCC SHRINKDATABASE ÃüÁî¡£ÈôÒªÒ»´ÎÊÕËõÒ»¸öÌض¨Êý¾Ý¿âÖеÄÒ»¸öÊý¾Ý»òÈÕÖ¾Îļþ£¬ÇëÖ´ÐÐ DBCC SHRINKFILE
ÃüÁî¡£
ÈôÒª²é¿´Êý¾Ý¿âÖе±Ç°µÄ¿ÉÓã¨Î´·ÖÅ䣩¿Õ¼äÁ¿£¬ÇëÔËÐÐ sp_spaceused
¡£
¿ÉÔÚ½ø³ÌÖеÄÈÎÒ»µãÍ£Ö¹ DBCC SHRINKDATABASE ²Ù×÷£¬ÈκÎÒÑÍê³ÉµÄ¹¤×÷¶¼½«±£Áô¡£ ......
ÎÒÃÇͨ³£ÔÚ¶¨Î»Êý¾Ý¿âËøÎÊÌâʱ£¬Í¨³£Ï£ÍûÕÒµ½Äĸö½ø³Ì·¢³öÁËÄĸöÓï¾ä£¬ËøסÁËÄÄÕÅ±í£¬Ò»°ãÎÒÃÇͨ¹ý²év$lock£¬È»ºóÕÒµ½sid,ÔÙµ½v$sesionÀïÕÒµ½Õâ¸ö½ø³ÌµÄhash_value»òpre_hash_value,È»ºó¸ù¾Ýhash_value¶¨Î»µ½¾ßÌåµÄÓï¾ä¡£
¿ÉÊÇ£¬ÎÒÃÇ·¢ÏÖ£¬Í¨¹ýJDBCÁ¬½ÓÉÏÀ´µÄ½ø³Ì£¬ËüµÄhash_valueÊÇ0,ËùÒÔÎÒÃǾÍÎÞ·¨¶¨Î»Õâ¸ö½ø³ÌÖ´ÐеÄÓï¾ ......