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
Ïà¹ØÎÊ´ð£º
ÏÖÔÚÓÐÒ»ORACLEÖеÄSQLÓï¾ä£¬ÐèÒªÒÆÖ²µ½DB2ÖУ¬ÇëÎʸÃSQL¸ÄÈçºÎд
ORACLEÖУº
select floor(months_between(date1,date2)) from A
date1,date2·Ö±ðΪ±íÖеÄÁ½¸ö×Ö¶Î £¬¶¼ÎªÈÕÆÚÐÍ
DB2ÖÐÈçºÎʹÓÃÐ ......
table1:
uID uName
1 СÀî
2 СÕÅ
table2:
pID uID type
1 1 H1
2   ......
Ö±½ÓÆô¶¯ µãÁ˵ÈÒ»»á¶ù¾Íû·´Ó¦ÁË È¥·þÎñÄÇÀïÆô¶¯»á³öÏÖÈçÏÂÌáʾ
³öÏÖ¡°±¾µØ¼ÆËã»úÉϵÄMSSQLSERVER·þÎñÆô¶¯ºóÓÖÍ£Ö¹ÁË¡£Ò»Ð©·þÎñ×Ô¶¯Í£Ö¹£¬Èç¹ûËüÃÇûÓÐʲô¿É×öµÄ
È»ºó»¹ÓÐʲôʲô²»´æÔÚ
......
ÓÐÁ½¸öͬÑùµÄ±í½á¹¹
±í½á¹¹ÈçÏ£º
id£¨ÐòºÅ£© parentid £¨¸¸½áµãÐòºÅ£© name(½áµãÃû³Æ)
±í1 ¼Ç¼ 1 0 aaa
2 ......