34,837
社区成员




declare @t table(col varchar(50))
insert @t select '中国林业出版社, 2000
840页 ;
7-5038-2336-4'
select
col,
rtrim(substring(col,charindex(char(10),col),charindex(';',col)-charindex(char(10),col))) as col2
from
@T
declare @t table(col varchar(50))
insert @t select '中国林业出版社, 2000
840页 ;
7-5038-2336-4'
select * from @t
select col ,substring(col,charindex('
',col)+2,charindex('页',col) - charindex('
',col) - 2) as col2 from @t
/*
col col2
-------------------------------------------------- --------------------------------------------------
中国林业出版社, 2000
840页 ;
7-5038-2336-4 840
(所影响的行数为 1 行)
*/
declare @t table(col varchar(50))
insert @t select '中国林业出版社, 2000
840页 ;
7-5038-2336-4'
select * from @t
select col ,substring(col,charindex('
',col)+2,charindex(';',col) - charindex('
',col)) as col2 from @t
/*
col col2
-------------------------------------------------- --------------------------------------------------
中国林业出版社, 2000
840页 ;
7-5038-2336-4 840页 ;
(所影响的行数为 1 行)
*/