日期:2014-05-18 浏览次数:20635 次
--> Test Data: @table1 declare @table1 table ([well_id] bigint) insert into @table1 select 677 union all select 23434 union all select 12 union all select 1234577 union all select 12345 union all select 1234521 union all select 456 --> Test Data: @table declare @table table ([a] varchar(100)) insert into @table select 'policy_id=(×××××)+project_id=(×××××)+site_id=(×××××)+well_id=(12345)' --Code --select * from @table1 --select * from @table declare @id varchar(100) select @id=substring(a,charindex('well_id=(',a)+9,5) from @table print 'well_id='+@id select * from @table1 where [well_id] like '%'+@id+'%' --Drop --Result /* well_id=12345 well_id -------------------- 1234577 12345 1234521 */