SQL×Ö·û´®º¯Êý
×Ö·û´®º¯Êý¶Ô¶þ½øÖÆÊý¾Ý¡¢×Ö·û´®ºÍ±í´ïʽִÐв»Í¬µÄÔËËã¡£´ËÀຯÊý×÷ÓÃÓÚCHAR¡¢
VARCHAR¡¢ BINARY¡¢ ºÍVARBINARY Êý¾ÝÀàÐÍÒÔ¼°¿ÉÒÔÒþʽת»»ÎªCHAR »òVARCHARµÄ
Êý¾ÝÀàÐÍ¡£¿ÉÒÔÔÚSELECT Óï¾äµÄSELECT ºÍWHERE ×Ó¾äÒÔ¼°±í´ïʽÖÐʹÓÃ×Ö·û´®º¯Êý¡£³£ÓõÄ
×Ö·û´®º¯ÊýÓУº
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶Ë×Ö·ûµÄASCII ÂëÖµ¡£ÔÚASCII£¨£©º¯ÊýÖУ¬´¿Êý×ÖµÄ×Ö·û´®¿É²»ÓÑ’À¨Æð
À´£¬µ«º¬ÆäËü×Ö·ûµÄ×Ö·û´®±ØÐëÓÑ’À¨ÆðÀ´Ê¹Ó㬷ñÔò»á³ö´í¡£
2¡¢CHAR()
½«ASCII Âëת»»Îª×Ö·û¡£Èç¹ûûÓÐÊäÈë0 ~ 255 Ö®¼äµÄASCII ÂëÖµ£¬CHAR£¨£© ·µ»ØNULL ¡£
3¡¢LOWER()ºÍUPPER()
LOWER()½«×Ö·û´®È«²¿×ªÎªÐ¡Ð´£»UPPER()½«×Ö·û´®È«²¿×ªÎª´óд¡£
4¡¢STR()
°ÑÊýÖµÐÍÊý¾Ýת»»Îª×Ö·ûÐÍÊý¾Ý¡£
STR (<float_expression>[£¬length[£¬ <decimal>]])
length Ö¸¶¨·µ»ØµÄ×Ö·û´®µÄ³¤¶È£¬decimal Ö¸¶¨·µ»ØµÄСÊýλÊý¡£Èç¹ûûÓÐÖ¸¶¨³¤¶È£¬È±Ê¡µÄ
length ֵΪ10£¬ decimal ȱʡֵΪ0¡£
µ±length »òÕßdecimal Ϊ¸ºÖµÊ±£¬·µ»ØNULL£»
µ±length СÓÚСÊýµã×ó±ß£¨°üÀ¨·ûºÅ룩µÄλÊýʱ£¬·µ»Ølength ¸ö*£»
ÏÈ·þ´Ólength £¬ÔÙÈ¡decimal £»
µ±·µ»ØµÄ×Ö·û´®Î»ÊýСÓÚlength £¬×ó±ß²¹×ã¿Õ¸ñ¡£
¶þ¡¢È¥¿Õ¸ñº¯Êý
1¡¢LTRIM() °Ñ×Ö·û´®Í·²¿µÄ¿Õ¸ñÈ¥µô¡£
2¡¢RTRIM() °Ñ×Ö·û´®Î²²¿µÄ¿Õ¸ñÈ¥µô¡£
Èý¡¢È¡×Ó´®º¯Êý
1¡¢left()
LEFT (<character_expression>£¬ <integer_expression>)
·µ»Øcharacter_expression ×óÆð integer_expression ¸ö×Ö·û¡£
2¡¢RIGHT()
RIGHT (<character_expression>£¬ <integer_expression>)
·µ»Øcharacter_expression ÓÒÆð integer_expression ¸ö×Ö·û¡£
3¡¢SUBSTRING()
SUBSTRING (<expression>£¬ <starting_ position>£¬ length)
·µ»Ø´Ó×Ö·û´®×ó±ßµÚstarting_ position ¸ö×Ö·ûÆðlength¸ö×Ö·ûµÄ²¿·Ö¡£
ËÄ¡¢×Ö·û´®±È½Ïº¯Êý
2
1¡¢CHARINDEX()
·µ»Ø×Ö·û´®ÖÐij¸öÖ¸¶¨µÄ×Ó´®³öÏֵĿªÊ¼Î»Öá£
CHARINDEX (<’substring_expression’>£¬ <expression>)
ÆäÖÐsubstring _expression ÊÇËùÒª²éÕÒµÄ×Ö·û±í´ïʽ£¬expression ¿ÉΪ×Ö·û´®Ò²¿ÉΪÁÐÃû±í´ïʽ¡£Èç
¹ûûÓз¢ÏÖ×Ó´®£¬Ôò·µ»Ø0 Öµ¡£
´Ëº¯Êý²»ÄÜÓÃÓÚTEXT ºÍIMAGE Êý¾ÝÀàÐÍ¡£
2¡¢PATINDEX()
·µ»Ø×Ö·û´®ÖÐij¸öÖ¸¶¨µÄ×Ó´®³öÏֵĿªÊ¼Î»Öá£
PATINDEX (<’%substring _expression%’&
Ïà¹ØÎĵµ£º
create table bookitem
(
bookname varchar(80) not null,
book_price Decimal(5,2) not null,
quantity int not null
)
insert into bookitem values('Image Processing',34.95,8)
insert into bookitem values('Signal Processing',51.75,6)
insert into bookitem values('Singal And System',48.5,10)
......
tomcatµÄÅäÖÃ:
1.ÈçºÎÐÞ¸ÄtomcatµÄ¶Ë¿Ú
2.ÈçºÎÉèÖÃÐéÄâĿ¼
3.ÈçºÎ¸øtomcatµÄ¹ÜÀíÔ±ÉèÖÃÃÜÂë
4.ÈçºÎÉèÖÃÊý¾ÝÔ´ºÍÁ¬½Ó³Ø(¹«Ë¾³£ÓÃ!)
(¶þ)ÈçºÎÐÞ¸ÄtomcatµÄ¶Ë¿Ú
ÔÚijЩÇé¿öÏ£¬¿ÉÄÜÐèÒªÐÞ¸Ätomcat¼àÌýµÄ¶Ë¿Ú8080 £¬±ÈÈ磺
¡ôÐèÒªÆô¶¯Á½·Ýtomcat·þÎñÆ÷
¡ôij¸ö·þÎñÕ¼ÓÃÁË8080¶Ë¿Ú
(Èý)ÈçºÎÐÞ¸ÄtomcatµÄ¶Ë¿Ú
ÐÞ¸Ätomca ......
Èç¹ûÏë²éÕÒ“_cs”½áβµÄµÄÕË»§
select * from [user] where loginname like '%_cs'ÊDz»Ðеģ¬_ ±»ÈÏΪÊÇÈÎÒâµÄ×Ö·û£¬
ËùÒÔÐèҪתÒå×Ö·û£¬ÓÐÁ½ÖÖд·¨£º
select * from [user] where loginname like '%[_]cs'
select * from [user] where loginname like '%/_cs' escape'/'
ͨÅä·ûº¬Òå
%
°üº¬Áã¸ö»ò¸ü¶à×Ö· ......
ÏÂͼÏÔʾÁËÊý¾Ý¿â±¸·ÝʱÎļþ¶ÁдµÄ¹ý³Ì£º
ÔÚ±¸·ÝÆڼ䣬SQL Server»áÔÚÊý¾Ý¿âÎļþÕâ±ßΪÿһÅÌ·û(Volume)´´½¨Ò»¸ö¶ÁÏ̡߳£¶ÁÏ̵߳Ť×÷ºÜ¼òµ¥£¬¾ÍÊÇ´ÓÎļþÖеÄÊý¾ÝÄÚÈÝ¡£Ã¿´ÎÕâ¸öÏ̶߳¼»á´ÓÎļþÖжÁ³ö²¿·ÖÊý¾Ý£¬È»ºó°ÑÊý¾Ý´æµ½»º³åÖÐ(buffer)¡£ÒòΪÓжà¸ö»º³å¿ÉÓã¬ËùÒÔÖ»ÒªÓлº³å¿ÉÒÔдÈëÊý¾Ý£¬¶ÁÏ߳̿ÉÒÔ²»Í£µÄ¶ÁÊý¾Ý¡ ......