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

sql ²éѯÖظ´¼Ç¼2


========µÚһƪ=========
ÔÚÒ»ÕűíÖÐij¸ö×Ö¶ÎÏÂÃæÓÐÖظ´¼Ç¼£¬Óкܶ෽·¨£¬µ«ÊÇÓÐÒ»¸ö·½·¨£¬ÊDZȽϸßЧµÄ£¬ÈçÏÂÓï¾ä£º
select data_guid from adam_entity_datas a where a.rowid > (select min(b.rowid) from adam_entity_datas b where b.data_guid = a.data_guid)
Èç¹û±íÖÐÓдóÁ¿Êý¾Ý£¬µ«ÊÇÖظ´Êý¾Ý±È½ÏÉÙ£¬ÄÇô¿ÉÒÔÓÃÏÂÃæµÄÓï¾äÌá¸ßЧÂÊ
select data_guid from adam_entity_datas where data_guid in (select data_guid from adam_entity_datas group by data_guid having count(*) > 1)
´Ë·½·¨²éѯ³öËùÓÐÖظ´¼Ç¼ÁË£¬Ò²¾ÍÊÇ˵£¬Ö»ÒªÊÇÖظ´µÄ¾ÍÑ¡³öÀ´£¬ÏÂÃæµÄÓï¾äÒ²Ðí¸ü¸ßЧ
select data_guid from adam_entity_datas where rowid in (select rid from (select rowid rid,row_number()over(partition by data_guid order by rowid) m from adam_entity_datas) where m <> 1)
Ä¿Ç°Ö»ÖªµÀÕâÈýÖֱȽÏÓÐЧµÄ·½·¨¡£
µÚÒ»ÖÖ·½·¨±È½ÏºÃÀí½â£¬µ«ÊÇ×îÂý£¬µÚ¶þÖÖ·½·¨×î¿ì£¬µ«ÊÇÑ¡³öÀ´µÄ¼Ç¼ÊÇËùÓÐÖظ´µÄ¼Ç¼£¬¶ø²»ÊÇÒ»¸öÖظ´¼Ç¼µÄÁÐ±í£¬µÚÈýÖÖ·½·¨£¬ÎÒÈÏΪ×îºÃ¡£
========µÚ¶þƪ=========
select usercode,count(*)       from ptype     group by usercode     having count(*) >1  
========µÚÈýƪ=========
ÕÒ³öÖظ´¼Ç¼µÄID:
select ID      from      
(         select ID ,count(*) as Cnt
from ÒªÏû³ýÖظ´µÄ±í
group by ID
) T1
where T1.cnt>1  
ɾ³ýÊý¾Ý¿âÖÐÖظ´Êý¾ÝµÄ¼¸¸ö·½·¨   
          Êý¾Ý¿âµÄʹÓùý³ÌÖÐÓÉÓÚ³ÌÐò·½ÃæµÄÎÊÌâÓÐʱºò»áÅöµ½Öظ´Êý¾Ý£¬Öظ´Êý¾Ýµ¼ÖÂÁËÊý¾Ý¿â²¿·ÖÉèÖò»ÄÜÕýÈ·ÉèÖÃ……     
·½·¨Ò»   
        declare @max integer,@id integer   
        declare cur_rows cursor local for select Ö÷×Ö¶Î,count(*) from     
            ±íÃû group by Ö÷×ֶΠhaving cou


Ïà¹ØÎĵµ£º

SQL Server CLRÈ«¹¦ÂÔÖ®Èý

±¾½ÚÖ÷Òª½éÉÜʹÓÃCLR´´½¨±êÁ¿º¯Êý£¬±íÖµº¯ÊýºÍ¾ÛºÏº¯Êý¡£
Ëùν±êÁ¿º¯ÊýÖ¸µÄ¾ÍÊǴ˺¯ÊýÖ»·µ»ØÒ»¸öÖµ¡£±íÖµº¯Êý·µ»ØÖµÊÇÒ»¸ö±í¡£¾ÛºÏº¯ÊýÊÇÔÚselectÓï¾äÖÐʹÓõģ¬ÓÃÀ´¾ÛºÏÒ»¸ö½á¹û¼¯£¬ÀàËÆÓÚSum()»òÊÇCount()µÈÄÚÖõĺ¯Êý£¬¶øÇÒÕæÕýµÄ×Ô¶¨Òå¾ÛºÏº¯ÊýÄ¿Ç°Ö»ÄÜÓÃCLRÀ´ÊµÏÖ¡£
ÏÂÃæµÄÀý×ÓʹÓÃÁËSQLServer×Ô´øµÄpubsÊý¾Ý¿â¡£
1 ......

SQLʹÓÃ

Êý¾Ý´¦ÀíÊǵ±Ç°Êý¾Ý¿â³£¼ûµÄÓ¦Óá£Ò»Ð©Êý¾Ý¿â×é³ÉDATA mart´ÓÊý¾ÝÔ´Àï³éÈ¡¹ØÐĵıí½øÐоۺϣ¬½«½á¹ûÍÆË͵½Ëã·¨ÖнøÐд¦Àí£¬´Ó¶ø¸ßÐÔÄܵĻشðÓû§µÄ²éѯ¡£
×ÜËùÖÜÖª£¬LogÎļþÊǼǼÊý¾Ý¿â²Ù×÷µÄÎļþ£¬¶ÔÊý¾Ý¿âµÄÍêÕûÐÔ£¬Ò»ÖÂÐÔÓÐ×ÅÖØÒªµÄÒâÒå¡£×÷ΪÊý¾Ý´¦ÀíµÄÒ»¸ö³£¼ûºó¹ûÊÇLogÎļþµÄ³¬¼¶ÅÓ´ó¡£ËäÈ»½«Êý¾Ý¿âµÄ»Ö¸´Ä£Ê½ÉèÖó ......

SQL Server CLRÈ«¹¦ÂÔÖ®ËÄ

CLR¿ÉÒÔʵÏÖDMLºÍDDLÁ½ÖÖ´¥·¢ÐÎʽ£¬µ«ÊDZ¾ÈËÒ»°ã²»½¨ÒéʹÓÃCLRµÄ´¥·¢Æ÷£¬Ö÷ÒªÊÇ¿¼Âǵ½Ð§ÂÊÎÊÌâ¡£±ÈÈçÎÒÃÇʹÓÃtriggerÀ´ÊµÏÖ·¢mailµÈ²Ù×÷ʱ£¬¾ÍÒª¿¼ÂÇpop3»òÊÇsmtpµÈ´ýʱ¼ä£¬ÒòΪtrigger±¾Ê¾ÍÊǸöÊÂÎñ£¬Ò²¾ÍÊÇ˵£¬ÔÚsmtpµÈ´ýʱ¼äÒ²ËãÔÚÁËÕû¸öÊÂÎñÖУ¬ÕâÑù¾Í»á´ó´óÓ°ÏìЧÂÊ¡£
1.CLR DML´¥·¢Æ÷
DMLÖ¸µÄÊÇÊý¾Ý²Ù×÷ÓïÑÔ£¬Ò²¾Í ......

SQL SERVER×Ö¶ÎÀàÐÍ˵Ã÷

 
bit£º0»ò1µÄÕûÐÍÊý×Ö
int£º´Ó-2^31(-2,147,483,648)µ½2^31(2,147,483,647)µÄÕûÐÍÊý×Ö
smallint£º´Ó-2^15(-32,768)µ½2^15(32,767)µÄÕûÐÍÊý×Ö
tinyint£º´Ó0µ½255µÄÕûÐÍÊý×Ö

decimal£º´Ó-10^38µ½10^38-1µÄ¶¨¾«¶ÈÓëÓÐЧλÊýµÄÊý×Ö
numeric£ºdecimalµÄͬÒå´Ê

money£º´Ó-2^63(-922,337,203,685,477.580 ......

½â¾ösql server¹ÒÆð

 ½â¾ö·½·¨...
¹ØÓÚSQL°²×°±»¹ÒÆðµÄÐÞ¸´´ó¼Ò¿ÉÄܶ¼Óöµ½¹ýµ±SQL±»É¾³ýºóÐèÒªÖØа²×°Ê±£¬½øÈë°²×°½çÃæ¾Í»á³öÏÖSQL´íÎóÌáʾ£º
´ÓÇ°µÄ°²×°³ÌÐò²Ù×÷ʹ°²×°³ÌÐò²Ù×÷¹ÒÆð£¬ÐèÒªÖØÐÂÆô¶¯¼ÆËã»ú
È»¶øÕâЩ¶¼Êǰ׷Ѿ¢£¬²»¹ÜÄãÖØÐÂÆô¶¯¶àÉÙ´ÎÒ²¶¼ÎÞ¼ÃÓÚÊ£¬ÏÂÃæÎҾͽ²½²ÔõÑùÄܹ»½â³ý°²×°»òÉý¼¶Ê±Îļþ±»¹ÒÆðµÄ²Ù×÷¡£
µã»÷ ¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ