SQL Substring
SQL ÖÐµÄ substring º¯ÊýÊÇÓÃÀ´×¥³öÒ»¸öÀ¸Î»×ÊÁÏÖеÄÆäÖÐÒ»²¿·Ö¡£Õâ¸öº¯ÊýµÄÃû³ÆÔÚ²»Í¬µÄ×ÊÁÏ¿âÖв»ÍêÈ«Ò»Ñù£º
MySQL: SUBSTR(), SUBSTRING()
Oracle: SUBSTR()
SQL Server: SUBSTRING()
×î³£Óõ½µÄ·½Ê½ÈçÏ (ÔÚÕâÀïÎÒÃÇÓÃSUBSTR()ΪÀý)£º
SUBSTR(str,pos): ÓÉ<str>ÖУ¬Ñ¡³öËùÓдӵÚ<pos>λÖÿªÊ¼µÄ×ÖÔª¡£Çë×¢Ò⣬Õâ¸öÓï·¨²»ÊÊÓÃÓÚSQL ServerÉÏ¡£
SUBSTR(str,pos,len): ÓÉ<str>ÖеĵÚ<pos>λÖÿªÊ¼£¬Ñ¡³ö½ÓÏÂÈ¥µÄ<len>¸ö×ÖÔª¡£
¼ÙÉèÎÒÃÇÓÐÒÔϵıí¸ñ£º
Geography ±í¸ñ
region_name
store_name
East
Boston
East
New York
West
Los Angeles
West
San Diego
Àý1:
SELECT SUBSTR(store_name, 3)
from Geography
WHERE store_name = 'Los Angeles';
½á¹û:
's Angeles'
Àý2:
SELECT SUBSTR(store_name,2,4)
from Geography
WHERE store_name = 'San Diego';
½á¹û:
'an D'
Ïà¹ØÎĵµ£º
---------Êýѧº¯Êý
1.¾ø¶ÔÖµ
S:select abs(-1) value
O:select abs(-1) value from dual
2.È¡Õû(´ó)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.È¡Õû£¨Ð¡£©
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.È¡Õû£¨½ØÈ¡£©
S:select cast ......
¹ØÓÚsqlÁ¬½Ó
Á¬½ÓÀàÐÍ
ÔÚ¹Øϵ´úÊýÖУ¬Á¬½ÓÔËËãÊÇÓÉÒ»¸öµÑ¿¨¶û»ýÔËËãºÍÒ»¸öÑ¡È¡ÔËËã¹¹³ÉµÄ¡£Ê×ÏÈÓõѿ¨¶û»ýÍê³É¶ÔÁ½¸öÊý¾Ý¼¯ºÏµÄ³ËÔËË㣬Ȼºó¶ÔÉú³ÉµÄ½á¹û
¼¯ºÏ½øÐÐÑ¡È¡ÔËË㣬ȷ±£Ö»°Ñ·Ö±ðÀ´×ÔÁ½¸öÊý¾Ý¼¯ºÏ²¢ÇÒ¾ßÓÐÖصþ²¿·ÖµÄÐкϲ¢ÔÚÒ»Æð¡£Á¬½ÓµÄÈ«²¿ÒâÒåÔÚÓÚÔÚˮƽ·½ÏòÉϺϲ¢Á½¸öÊý¾Ý¼¯ºÏ£¨Í¨³£ÊÇ±í£©£¬²¢²úÉú
Ò ......
Ò»¡¢ÔÚDelphi7ÖÐÁ¬½ÓMS SQL Server 2000µÄ·½·¨¡£
¸Õ¿ªÊ¼Ê±½çÃæÈçÏ£ºÌí¼Ó4¸ö¿Ø¼þ¡£
ÉèÖÿؼþÊôÐÔ¹ý³Ì£º
1¡¢ADOConnection1ÉèÖÃ
1£©Ë«»÷ADOConnection1£¬½øÐÐÉèÖÃÁ¬½Ó×Ö·û´®£¨×÷ÓÃÊÇ£ºÑ¡È¡Á¬½ÓÇý¶¯·½Ê½ºÍÁ¬½ÓµÄÊý¾Ý¿âÉèÖã©¡£¹ý³ÌÈçÏÂͼËùʾ£º
2¡¢ADOQuery1ÉèÖãº
1£©ADOQuery1.connectionÊôÐÔΪADOConnection1; ......
--²é¿´CPUÀûÓÃÂÊ
-- CREATE PROCEDURE sp_GetTop10_CPU () AS
BEGIN
SET NOCOUNT ON
DECLARE @cinterval char(8)
DECLARE @interval int
SET @cinterval = '00:00:10'
CREATE TABLE #thread
(
RUN INT NOT NULL,
SPI ......