sql ½ØÈ¡×Ö·û´®
ÎÒÒªµÃµ½Ò»¸ö×Ö·û´®È磺
sdfk|||sgts
sdfsfd|||rgreg
wrfw|||sefw
¾ÍÊÇÒªµÃµ½|||ºóÃæµÄ×Ö·û´®£¬ÓÐʲôº¯ÊýÂð£¿ÔõôÓÃÄØ£¿Ð»Ð»£¡
SQL code:
select
right(col,len(col)-charindex('|||',col)-2)
from
tb
SQL code:
--> ²âÊÔÊý¾Ý£º[TB]
if object_id('[TB]') is not null drop table [TB]
create table [TB]([col] varchar(14))
insert [TB]
select 'sdfk|||sgts' union all
select 'sdfsfd|||rgreg' union all
select 'wrfw|||sefw'
select parsename(replace(col,'|||','.'),1) from [TB]
/*
--------------------------------------------------------------------------------------------------------------------------------
sgts
rgreg
sefw
£¨ËùÓ°ÏìµÄÐÐÊýΪ 3 ÐУ©
*/
drop table TB
SQL code:
SELECT STUFF(COL,CHARINDEX('|||',COL)+2,'') from TB
SQL code:
--try
select substring(replace(aa,'|||','|'),charindex('|',aa)+1,100) from @tb
Ïà¹ØÎÊ´ð£º
ÇëÎÊһϣ¬ÍâÍøÁ½Ì¨SQLSERVERʵÀýÊý¾Ý´«Ê䣬ÓÐûÓвÉÓÃÊý¾ÝѹËõºÍ¼ÓÃÜ¡£Ñ¹Ëõ±ÈÊǶàÉÙ£¬¼ÓÃÜÊÇʲô¼ÓÃÜËã·¨£¿Ïà¹ØÎĵµÄÄÀï¿ÉÒÔÕÒµ½£¿Ð»Ð»
ÎÒÒ²ÏëÖªµÀ£¡¹Ø×¢´ËÌù£¡
¹Ø×¢¡«¡«
Êý¾Ý¿â´óÅ£¶¼ÄÄÈ¥Á˰¡£¿
......
ÏÖÔÚÓÐÒ»ORACLEÖеÄSQLÓï¾ä£¬ÐèÒªÒÆÖ²µ½DB2ÖУ¬ÇëÎʸÃSQL¸ÄÈçºÎд
ORACLEÖУº
select floor(months_between(date1,date2)) from A
date1,date2·Ö±ðΪ±íÖеÄÁ½¸ö×Ö¶Î £¬¶¼ÎªÈÕÆÚÐÍ
DB2ÖÐÈçºÎʹÓÃÐ ......
Èç¹ûÓÃsqlÓï¾ä¸ü¸Älj×ֶεÄ·¾¶£¬ÈçÏ£º
lj
7/200781616183095962.jar
8/f_200812111413292.jar
8/f_200812111413291.jar
µÃµ½µÄ½á¹ûÈçÏ£º
lj
1/7/200781616183095962.jar
1/8/f_20081 ......
Ö±½ÓÆô¶¯ µãÁ˵ÈÒ»»á¶ù¾Íû·´Ó¦ÁË È¥·þÎñÄÇÀïÆô¶¯»á³öÏÖÈçÏÂÌáʾ
³öÏÖ¡°±¾µØ¼ÆËã»úÉϵÄMSSQLSERVER·þÎñÆô¶¯ºóÓÖÍ£Ö¹ÁË¡£Ò»Ð©·þÎñ×Ô¶¯Í£Ö¹£¬Èç¹ûËüÃÇûÓÐʲô¿É×öµÄ
È»ºó»¹ÓÐʲôʲô²»´æÔÚ
......
ÓÐÁ½¸öͬÑùµÄ±í½á¹¹
±í½á¹¹ÈçÏ£º
id£¨ÐòºÅ£© parentid £¨¸¸½áµãÐòºÅ£© name(½áµãÃû³Æ)
±í1 ¼Ç¼ 1 0 aaa
2 ......