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 ÐУ©
===============
Ïà¹ØÎĵµ£º
SQL×¢ÈëÊÇ×î³£¼ûµÄ¹¥»÷·½Ê½Ö®Ò»,Ëü²»ÊÇÀûÓòÙ×÷ϵͳ»òÆäËüϵͳµÄ©¶´À´ÊµÏÖ¹¥»÷µÄ,¶øÊdzÌÐòÔ±ÒòΪûÓÐ×öºÃÅжÏ,±»²»·¨
Óû§×êÁËSQLµÄ¿Õ×Ó,ÏÂÃæÎÒÃÇÏÈÀ´¿´ÏÂʲôÊÇSQL×¢Èë:
±ÈÈçÔÚÒ»¸öµÇ½½çÃæ,ÒªÇóÓû§ÊäÈëÓû§ÃûºÍÃÜÂë:
& ......
sqlÈÕÆÚº¯Êý(ת)
[ 2007-8-23 16:33:00 | By: ²½ ]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)
4.¼¾¶ÈµÄµÚÒ»Ìì
Select DATEADD(qq, DATEDIFF(qq,0,getdat ......
СµÜÏëÎʸöÎÊÌ⣬ÔÚSQL Server 2005ÉÏ£¬½¨Á¢Ö÷¼üµÄͬʱ¾Í»áĬÈÏÔÚÖ÷¼üÉÏÉèÖþ۴ØË÷Òý£¬ÄÇôÄÜ·ñÔÚÒ»¸ö×Ö¶ÎÉÏÉèÖÃÖ÷¼üºÍΨһÐÔË÷Òý£¨Unique£©£¬µ«ÊǰѾ۴ØË÷ÒýÉèÖõ½ÁíÒ»¸ö×Ö¶ÎÉÏ£¿
¾Ù¸ö¼òµ¥µÄÀý×Ó£¬±ÈÈçÎÒÓиö±í½ÐTableTest£¬±íÀïÓÐÁ½¸ö×ֶΣ¬id,date£¬±¾À´idÊÇÖ÷¼üµÄ£¬ÎÒÏÖÔÚÏë°Ñ¾Û´ØË÷ÒýÉèÖõ½date×Ö¶ÎÉÏ¡£
ÎÒÏÈɾ³ýÖ ......
¡¾Ê¾Àý1.1¡¿ ²éѯ¹ÍÔ±±àºÅΪ7788µÄ¹ÍÔ±ÐÕÃûºÍ¹¤×Ê¡£
²½Öè1£ºÓÃSCOTT/TIGERÕË»§µÇ¼SQL*Plus¡£
²½Öè2£ºÔÚÊäÈëÇøÊäÈëÒÔϳÌÐò£º
/*ÕâÊÇÒ»¸ö¼òµ¥µÄʾÀý³ÌÐò*/
SET SERVEROUTPUT ON
DECLARE--¶¨Ò岿·Ö±êʶ
v_name VARCHAR2 ......
¡¡×î½üÔÚÕÛÌÚ PHP + MYSQL
µÄ±à³Ì¡£Á˽âÁËһЩ PHP SQL ×¢Èë¹¥»÷
µÄ֪ʶ£¬ÓÚÊÇдÁËÕâƪÎÄÕ¡¡http://www.xiaohui.com/weekly/20070314.htm£¬×ܽáһϾÑé¡£ÔÚÎÒ¿´À´£¬Òý·¢ SQL ×¢Èë¹¥»÷
µÄÖ÷ÒªÔÒò£¬ÊÇÒòΪÒÔÏÂÁ½µãÔÒò£º
¡¡¡¡1. php ÅäÖÃÎļþ php.ini ÖÐµÄ magic_quotes_gpc
Ñ¡ÏîûÓдò¿ª£¬±»ÖÃΪ off
¡¡¡¡2. ¿ª·¢ ......