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

SQLÓï¾ä

1. ˵Ã÷£º¸´ÖƱí(Ö»¸´Öƽṹ£¬Ô´±íÃû£ºa£¬Ð±íÃû£ºb)
SQL: select * into b from a where 1<>1;
        2. ˵Ã÷£º¿½±´±í(¿½±´Êý¾Ý£¬Ô´±íÃû£ºa£¬Ä¿±ê±íÃû£ºb)
SQL: insert into b(a, b, c) select d, e, f from b;
        3. ˵Ã÷£ºÏÔʾÎÄÕ¡¢Ìá½»È˺Í×îºó»Ø¸´Ê±¼ä
SQL: select a.title, a.username, b.adddate
     from table a,(
          select max(adddate) adddate
          from table where table.title=a.title) b ¡¡
        4. ˵Ã÷£ºÍâÁ¬½Ó²éѯ(±íÃû1£ºa£¬±íÃû2£ºb)
SQL: select a.a, a.b, a.c, b.c, b.d, b.f
     from a LEFT OUT JOIN b ON a.a = b.c; ¡¡
        5. ˵Ã÷£ºÈճ̰²ÅÅÌáǰÎå·ÖÖÓÌáÐÑ
SQL: select *
     from Èճ̰²ÅÅ
     where datediff(’’minute’’, f¿ªÊ¼Ê±¼ä, getdate())>5 ¡¡¡¡
¡¡¡¡
        6. ˵Ã÷£ºÁ½ÕŹØÁª±í£¬É¾³ýÖ÷±íÖÐÒѾ­ÔÚ¸±±íÖÐûÓеÄÐÅÏ¢
SQL: delete from info
     where not exists(
           select *
           from infobz
           where info.infid=infobz.infid );
        7. ˵Ã÷£º——
SQL: SELECT A.NUM, A.NAME, B.UPD_DATE, B.PREV_UPD_DATE
     from TABLE1,(SELECT X.NUM, X.UPD_DATE, Y.UPD_DATE PREV_UPD_DATE
                  from (SELECT NUM, UPD_DATE, INBOUND_QTY, STOCK_ONHAND
                        from TABLE2
  &nb


Ïà¹ØÎĵµ£º

SQL ÖÐGROUP BY ×ܽá

GROUP BY ×Ó¾äÓÃÀ´¶ÔÖ¸¶¨µÄ×Ö¶Î×ö·Ö×飬²úÉúÒ»¸ö»ã×ÜÐÅÏ¢¡£ £¨1£©group byÓï¾ä¶ÔselectºóËùÑ¡ÔñµÄ×Ö¶ÎÓÐÒ»¶¨µÄÏÞÖÆ£¬¼´selectºóûÓÐʹÓþۺϺ¯ÊýµÄ×ֶαØÐë°üº¬ÔÚgroup by Óï¾äºóÃæµÄ½á¹û¼¯ÖС££¨GROUP BY ¹Ø¼ü×Öºó¸úÒ»¸öÁеÄÁÐ±í£¬³ÆÎª×éºÏÁУ©. £¨2£©²»ÄܶÔÊý¾ÝÀàÐÍΪ ntext¡¢text¡¢image »ò bit µÄÁÐʹÓà GROUP BY »ò ......

SQL×Ö·û´®´¦Àíº¯Êý´óÈ«

SQL×Ö·û´®´¦Àíº¯Êý´óÈ«(ת)2008-04-01 17:21SQL×Ö·û´®´¦Àíº¯Êý´óÈ«(ת)select ×Ö¶Î1 from ±í1 where ×Ö¶Î1.IndexOf("ÔÆ")=1;
ÕâÌõÓï¾ä²»¶ÔµÄÔ­ÒòÊÇindexof£¨£©º¯Êý²»ÊÇsqlº¯Êý£¬¸Ä³Ésql¶ÔÓ¦µÄº¯Êý¾Í¿ÉÒÔÁË¡£
left£¨£©ÊÇsqlº¯Êý¡£
select ×Ö¶Î1 from ±í1 where charindex£¨'ÔÆ',×Ö¶Î1£©=1; ×Ö·û´®º¯Êý¶Ô¶þ½øÖÆÊý¾Ý¡¢×Ö·û´ ......

ÀûÓÃÕýÔò±í´ïʽʵÏֵļòµ¥µÄÕûÀíSQLÎı¾µÄС¹¤¾ß

ÏÂÔØµØÖ·£º http://download.csdn.net/source/1805903
  private string ReArrange(string str)
{
string[] keywords = new string[] {"select","from","where","and","order\\s+by","or","into",
"update","set","delete","haveing" ......

SQLÖÐobject_idº¯ÊýµÄÓ÷¨

 int object_id('objectname');
´Ë·½·¨·µ»ØÊý¾Ý¿â¶ÔÏó±êʶºÅ¡£
ÆäÖУ¬²ÎÊýobjectname ±íʾҪʹÓõĶÔÏ󣬯äÊý¾ÝÀàÐÍΪnchar»òchar£¨Èç¹ûΪchar£¬ÏµÍ³½«Æäת»»Îªnchar£©
·µ»ØÀàÐÍΪint£¬±íʾ¸Ã¶ÔÏóÔÚϵͳÖеıàºÅ¡£
±ÈÈ磺
use wf_timesheet
select object_id('usp_check_excess_hours')
·µ»ØÎª197575742¡£
´Ë· ......

SQL ServerÖ®·Ö²¼Ê½ÊÂÎñ

--> Title  : SQL ServerÖ®·Ö²¼Ê½ÊÂÎñ
--> Author : wufeng4552
--> Date   : 2009-11-11
SQL ServerÖ®·Ö²¼Ê½ÊÂÎñ
(Ò»)¸ÅÄî:
·Ö²¼Ê½ÊÂÎñÊÇÉæ¼°À´×ÔÁ½¸ö»ò¶à¸öÔ´µÄ×ÊÔ´µÄÊÂÎñ¡£Microsoft® SQL Server™ 2000Ö§³Ö·Ö²¼Ê½ÊÂÎñ£¬Ê¹Óû§µÃÒÔ´´½¨ÊÂÎñÀ´¸üжà¸öSQL ServerÊý¾Ý¿âºÍÆäËüÊý¾ÝÔ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ