create proc proc_test2 ( @a int )
as
begin
set nocount on
select case when (b is not null or b <> ‘’) and (c is not null or c <> ‘’) then 'B('+ B+ ')'+ 'C('+ C+ ')'
when (b is not null or b <> ‘’) and (c is null or c = ‘’) then 'B('+ B+ ')'
when (b is null or b = ‘’) and (c is not null or c <> ‘’) then 'C('+ C+ ')'
end
from test2 where a=@a
set nocount off
end
現在不能轉可用分了.你如果需要可用分,我可以給你.
as
begin
set nocount on
select case when (b is not null or b <> ‘’) and (c is not null or c <> ‘’) then 'B('+ B+ ')'+ 'C('+ C+ ')'
when (b is not null or b <> ‘’) and (c is null or c = ‘’) then 'B('+ B+ ')'
when (b is null or b = ‘’) and (c is not null or c <> ‘’) then 'C('+ C+ ')'
end
from test2 where a=@a
set nocount off
end
現在不能轉可用分了.你如果需要可用分,我可以給你.
when b is not null and c is null then 'B('+ B+ ')'
when b is null and c is not null then 'C('+ C+ ')'
end
from test2 where a=1
执行出来什么结果?
FROM TABLE where A=@A; 如果 trim 不行 改成 alltrim(b)_ , lefttrim(righttrim(b)) 试试
你有个概念错误:
''不等于null
update table set c = null where rtrim(c) = ''