原文在23楼tim_spac:http://topic.csdn.net/u/20100312/17/70138908-f169-4fa0-ac27-28601ee81c3b.html
select * from t where a = @id
union
select 0 where not exists (select 1 from t where t.a=@id)
原文在23楼tim_spac:http://topic.csdn.net/u/20100312/17/70138908-f169-4fa0-ac27-28601ee81c3b.html
select * from t where a = @id
union
select 0 where not exists (select 1 from t where t.a=@id)