rtexample:insert ..
when type = 1 then
insert tab_a(...) values(...)
when type = 2 then
insert tab_b(...) values(...)
when type = 3 then
insert tab_c(...) values(..)
....
select *
from src_a
where type in(1,2,3...)查询src_a表,根据type 的值,分别insert到不同的表。请问这个sql server 2005 是否可以做到?
when type = 1 then
insert tab_a(...) values(...)
when type = 2 then
insert tab_b(...) values(...)
when type = 3 then
insert tab_c(...) values(..)
....
select *
from src_a
where type in(1,2,3...)查询src_a表,根据type 的值,分别insert到不同的表。请问这个sql server 2005 是否可以做到?
when type = 1 then
insert tab_a(...) values(...)
when type = 2 then
insert tab_b(...) values(...)
when type = 3 then
insert tab_c(...) values(..)
然后
select 函数名(type) from src_a
where type in(1,2,3...)
select @typeid=typeid from yourtableif(@typeid=1)
begin
//////////////////
end
else if(@typid=2)
begin
///////////////
end
else
begin
///////////
end