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

ʹÓÃÁÙʱ±íÌáÉýSqlServerÊÓͼ²éѯÐÔÄÜ

дÁËÒ»¸ö´æ´¢¹ý³Ì¶ÔÊÓͼ½øÐзÖÒ³²éѯ£¬µ«Êý¾ÝÔö¶àºó·¢ÏÖ»ùЧÂʵ͵ÃÒªÃü£¬ÈýÍò¶àÌõÊý¾ÝÒª²éѯһ¸ö°ëСʱ¶¼Ã»³öÀ´£¬Õâ²»ÊÇÒªÁËÃü£¬ÓÚÊÇÏëµ½ÁËË÷Òý£¬Ó¦ÓùýºóÈÔÎÞ¼ÃÓÚÊ¡£×îºó¶Ôsql½øÐзÖÎöºÍʵ¼ùÖеóö£¬Ê¹ÓÃÁÙʱ±í¿ÉÒÔ´ó´ó¼Ó¿ìÊÓͼµÄ²éѯËٶȣ¬¼ûÈçÏÂsqlÓï¾ä
ÐÔÄܳ¬µÍµÄÊÓͼ·ÖÒ³sqlÓï¾ä£º
select top 100 * from
view_customerPayDetails where
( 1=1) and (payId not in
(select top 100 payId from
view_customerPayDetails where
( 1=1) order by payId desc))order by payId desc
ʹÓÃÁÙʱ±íÌáÉýÐÔÄܵÄsqlÓï¾ä£º
select top 100 payId into #tmpTable
from view_customerPayDetails
order by payId desc
select top 100 * from view_customerPayDetails
where  payId not in (select payId from #tmpTable )
order by payId desc
drop table #tmpTable


Ïà¹ØÎĵµ£º

ÓÃSQLÓï¾äµÃµ½SQLServer µÄ±íÖеÄÁеÄÃèÊöÖµ

 select   case   when   c.colid=1   then   object_name(c.id)   else   ''   end   as   ±íÃû    
  ,c.name   as   ×Ö¶ÎÃû  
  ,t.name   Êý¾ÝÀàÐÍ  
  ,c.prec   as   ³¤¶È   ......

SQLServer 2008¿çÊý¾Ý¿âʵÀýÊÂÎñ´¦Àí

 ÍÐÁ˼¸ÌìµÄÄÑÌ⣬ÖÕÓÚ½â¾öÁË¡£ÌØ·ÖÏíÒ»ÏÂ
ÒÔÏÂÊÇÒ»¸ö´æ´¢¹ý³Ì
CREATE PROCEDURE deleteAccountAll
 @id int
AS
SET XACT_abort ON
BEGIN DISTRIBUTED TRAN
delete from AccountCapital where accountid = @id
delete from logininfo where username = @id
delete from CapitalRecord where accountid ......

ÔÚSqlServer´æ´¢¹ý³ÌÖÐʹÓÃCursor£¨Óα꣩²Ù×÷¼Ç¼

 
1. ΪºÎʹÓÃÓα꣺
    
ʹÓÃÓαê(cursor)µÄÒ»¸öÖ÷ÒªµÄÔ­Òò¾ÍÊǰѼ¯ºÏ²Ù×÷ת»»³Éµ¥¸ö¼Ç¼´¦Àí·½Ê½¡£ÓÃSQLÓïÑÔ´ÓÊý¾Ý¿âÖмìË÷Êý¾Ýºó£¬½á¹û·ÅÔÚÄÚ´æµÄÒ»¿éÇøÓòÖУ¬ÇÒ½á¹û
ÍùÍùÊÇÒ»¸öº¬Óжà¸ö¼Ç¼µÄ¼¯ºÏ¡£Óαê»úÖÆÔÊÐíÓû§ÔÚSQL serverÄÚÖðÐеطÃÎÊÕâЩ¼Ç¼£¬°´ÕÕÓû§×Ô¼ºµÄÒâÔ¸À´ÏÔʾºÍ´¦ÀíÕ ......

Sqlserver£º´ÓXMLÎļþÖжÁÈ¡ÅäÖÃÐÅÏ¢

ÈçºÎÔÚSqlserverÖдÓÍⲿXMLÎļþÖжÁÈ¡ÅäÖÃÐÅÏ¢ÄØ£¿¸ÃÎÊÌâÔ´×ÔÒ»¼ÒÆóÒµµÄ±ÊÊÔÐÅÏ¢ÓиС£
Ò»xmlÎļþÄÚÈÝ£º
<?xml version="1.0" encoding="utf-8"?>
<root>
  <db name="ClientDB1" datasize="512MB" datagrowth="100MB" logsize="100MB" loggrowth ="50MB">
  </db>
  <db ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ