日期:2014-05-17 浏览次数:20713 次
if '0005'='a'
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'='a'
begin
select xm,bj,km
from opendatasource(
'sqloledb',
'data source=192.168.1.98;User ID=sa;Password=hhdsql2'
).my.dbo.tb1
end
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
end
if '0005'='a' begin select 1 end else if '0009'='a' begin select 2 end else begin select 3 end
------解决方案--------------------
没看到你的赋值,if '0005'='a' 中'a'都是常量,应该是 if '0005'=@a
------解决方案--------------------