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

SQL ×Ö·û´®º¯ÊýС×ܽá

Á·ÊÖ£¬Ã¿Ìì²é¿´±ðÈ˵Ķ«Î÷£¬²»Èç×Ô¼º×ܽáºÃ
1:replace º¯Êý
µÚÒ»¸ö²ÎÊýÄãµÄ×Ö·û´®£¬µÚ¶þ¸ö²ÎÊýÄãÏëÌæ»»µÄ²¿·Ö£¬µÚÈý¸ö²ÎÊýÄãÒªÌæ»»³Éʲô
select replace('lihan','a','b')
                                                                 
-----------------------------
lihbn
£¨ËùÓ°ÏìµÄÐÐÊýΪ 1 ÐУ©
=========================================================
2:substringº¯Êý
µÚÒ»¸ö²ÎÊýÄãµÄ×Ö·û´®£¬µÚ¶þ¸öÊÇ¿ªÊ¼Ì滻λÖ㬵ÚÈý¸ö½áÊøÌæ»»Î»ÖÃ
select substring('lihan',0,3);
-----
li
£¨ËùÓ°ÏìµÄÐÐÊýΪ 1 ÐУ©
=========================================================
3:charindexº¯Êý
µÚÒ»¸ö²ÎÊýÄãÒª²éÕÒµÄchar£¬µÚ¶þ¸ö²ÎÊýÄã±»²éÕÒµÄ×Ö·û´® ·µ»Ø²ÎÊýÒ»ÔÚ²ÎÊý¶þµÄλÖÃ
select  charindex('a','lihan')
-----------
4
£¨ËùÓ°ÏìµÄÐÐÊýΪ 1 ÐУ©
===========================================================
4£ºASCIIº¯Êý
·µ»Ø×Ö·û±í´ïʽÖÐ×î×ó²àµÄ×Ö·ûµÄ ASCII ´úÂëÖµ¡£
select ASCII('lihan')
-----------
108
£¨ËùÓ°ÏìµÄÐÐÊýΪ 1 ÐУ©
================================================================
5£ºncharº¯Êý
¸ù¾Ý Unicode ±ê×¼µÄ¶¨Ò壬·µ»Ø¾ßÓÐÖ¸¶¨µÄÕûÊý´úÂëµÄ Unicode ×Ö·û¡£
²ÎÊýÊǽéÓÚ 0 Óë 65535 Ö®¼äµÄÕýÕûÊý¡£Èç¹ûÖ¸¶¨Á˳¬³ö´Ë·¶Î§µÄÖµ£¬½«·µ»Ø NULL¡£
select nchar(3213)
----
unicode×Ö·û
£¨ËùÓ°ÏìµÄÐÐÊýΪ 1 ÐУ©
=========================================================
6£ºsoundex
·µ»ØÒ»¸öÓÉËĸö×Ö·û×é³ÉµÄ´úÂë (SOUNDEX)£¬ÓÃÓÚÆÀ¹ÀÁ½¸ö×Ö·û´®µÄÏàËÆÐÔ¡£
SELECT SOUNDEX ('lihan'), SOUNDEX ('lihon');
----- -----
L546  L542
£¨ËùÓ°ÏìµÄÐÐÊýΪ 1 ÐУ©
=========================================================
7£ºchar
²ÎÊýΪ½éÓÚ 0 ºÍ 255 Ö®¼äµÄÕûÊý¡£Èç¹û¸ÃÕûÊý±í´ïʽ²»ÔÚ´Ë·¶Î§ÄÚ£¬½«·µ»Ø NULL Öµ¡£
SELECT char(125)
----
}
£¨ËùÓ°ÏìµÄÐÐÊýΪ 1 ÐУ©
===============


Ïà¹ØÎĵµ£º

oracle PL SQLѧϰ°¸Àý£¨Ò»£©

¡¾Ê¾Àý1.1¡¿  ²éѯ¹ÍÔ±±àºÅΪ7788µÄ¹ÍÔ±ÐÕÃûºÍ¹¤×Ê¡£
  ²½Öè1£ºÓÃSCOTT/TIGERÕË»§µÇ¼SQL*Plus¡£
  ²½Öè2£ºÔÚÊäÈëÇøÊäÈëÒÔϳÌÐò£º
   /*ÕâÊÇÒ»¸ö¼òµ¥µÄʾÀý³ÌÐò*/
  SET SERVEROUTPUT ON
  DECLARE--¶¨Ò岿·Ö±êʶ
    v_name  VARCHAR2 ......

oracle PL SQLѧϰ°¸Àý£¨¶þ£©

¡¾ÑµÁ·6.1¡¿¡¡Ê¹ÓÃÒþʽÓαêµÄÊôÐÔ£¬Åж϶ԹÍÔ±¹¤×ʵÄÐÞ¸ÄÊÇ·ñ³É¹¦¡£
²½Öè1£ºÊäÈëºÍÔËÐÐÒÔϳÌÐò£º
BEGIN
  UPDATE emp SET sal=sal+100 WHERE empno=1234;
  IF SQL%FOUND THEN
       DBMS_OUTPUT.PUT_LINE('³É¹¦Ð޸ĹÍÔ±¹¤×Ê£¡');
       ......

SQl 2005 For XMl ¼òµ¥²éѯ(Raw£¬Auto£¬Pathģʽ)(2)

ÎÄÕµ¼º½ SQL Server 2005 ѧϰ±Ê¼ÇϵÁÐÎÄÕµ¼º½
     ÔÚSQl 2005 For XMl ¼òµ¥²éѯ(Raw£¬Auto£¬Pathģʽ)(1) ÀïÎÒÃÇ˵Á˹ØÓÚPath£¬RawºÍAutoģʽµÄÓ÷¨£¬ÆäʵÀïÃæ²»½ö½ö ÊÇÕâЩ¼òµ¥µÄ²Ù×÷£¬»¹ÓÐһЩÆäËüµÄÌØÐÔ£¬±ÈÈç˵Type»òOpenXml·½·¨£¬sp_xml_preparedocument´æ´¢¹ý³Ì µÈÕâЩÔö¼ÓµÄ¶«¶«£¬ÎÒÃÇÀ´Ò» ......

SQL server 2005(´æ´¢¹ý³Ì)


Ò»£®¸ÅÊö
   ´æ´¢¹ý³ÌÊÇÒ»×éÔ¤ÏȱàÒëºÃµÄT--SQL´úÂ룬ǿµ÷Ò»µã£ºÕâЩ´úÂëÊÇÔ¤±àÒëºÃµÄ£¬¼´ÔÚÖ´ÐÐʱ¾Í²»ÓÃÔÚ½øÐбàÒëÁË£¬ÕâÑù»áÌá¸ß³ÌÐòµÄÔËÐÐЧÂÊ¡£ËüÀàËÆÓÚÆäËû¸ß¼¶ÓïÑÔÀïµÄ¹ý³Ì£¬¼´Íê³ÉÌØ¶¨¹¦Äܵĺ¯Êý¡£´æ´¢¹ý³Ì·ÖÁ½ÀࣺϵͳÌṩµÄ´æ´¢¹ý³Ì£¬Óû§×Ô¼º¶¨ÒåµÄ´æ´¢¹ý³Ì£¬ÏµÍ³¶¨ÒåµÄÒÔ sp_Ϊǰ׺¡£
¶ ......

дÁËÒ»¸öÉÔ΢¸´ÔÓµãµÄsqlÐĵÃ

select pcode from (
        select h.k,h.d,h.m,h.u,l.areacode,
               l.areacode||substr(h.u,4,length(h.u))||h.k pcode
         from(
 &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ