if '0005'='0008'
begin
select 1
end
else if '0009'='0008'
begin
select 2
end
else
begin
select 3
end
SQL code
if '0005'='0008'
begin
select xm,bj,km
from opendatasource(
'sqloledb',
'data source=192.168.1.99;User ID=sa;Password=hhdsql1'
).my.dbo.tb1
end
else if '0009'='0008'
begin
select xm,bj,km
from opendatasource(
'sqloledb',
'data source=192.168.1.98;User ID=sa;Password=hhdsql2'
).my.dbo.tb1
end
else
begin
select xm,bj,km
from opendatasource(
'sqloledb',
'data source=192.168.1.97;User ID=sa;Password=hhdsql3'
).my.dbo.tb1
end