如下:
A 字段 是 text 类型的 。 B 字段 是 int 类型的。 需要取出 A 字段中不包含 B 字段的记录。
如
A B
上海(220032)交易 220033
上海(339495)不交易 500002
上海 交易 399999那么 取出的记录 应该就是 上海(339495)不交易 500002
上海 交易 399999
A 字段 是 text 类型的 。 B 字段 是 int 类型的。 需要取出 A 字段中不包含 B 字段的记录。
如
A B
上海(220032)交易 220033
上海(339495)不交易 500002
上海 交易 399999那么 取出的记录 应该就是 上海(339495)不交易 500002
上海 交易 399999
RETURNS VARCHAR(100)
AS
BEGIN
WHILE PATINDEX('%[^0-9]%',@S) > 0
BEGIN
set @s=stuff(@s,patindex('%[^0-9]%',@s),1,'')
END
RETURN @S
END
GO
select dbo.fn_get_number('sdfa北京市56中国的首都010sKSD海淀区*&^')
GO
select *
from tab
where charindex(convert(varchar(6),B),convert(varchar(max),A))=0
create table a(a varchar(30),b int)
insert into a
select '上海(220033) 交易',220033 union all
select '上海 不交易',500002 union all
select '交易',500002select * from a where CHARINDEX(convert(varchar(20),a.b),a.a,0) = 0--drop table a
-----------------
上海 不交易 500002
交易 500002