求一個通用的SQL
每次查詢時隻查一條記錄,結果如下: 
 表a: 
 code         name         sex               tel                        fax                     add                     rmk       
 A01            新發         男                  8568544            8786884         廣州市               few   
 表b: 
 col 
 code 
 name 
 sex 
 tel 
 fax 
 add   
 結果: 
 col1                                       col2 
 -----                                    ----- 
 code                                       A01 
 name                                       新發 
 sex                                          男                   
 tel                                          8568544             
 fax                                          8786884          
 add                                          廣州市 
 注:不能用case
------解决方案--------------------declare @sql varchar(8000) 
 set @sql = ' ' 
 select @sql=@sql+ ' select  ' ' '+col+ ' ' ' as col1, '+col+ ' as col2 from a where code= ' 'A01 ' ' union all ' 
 from b   
 set @sql=left(@sql,len(@sql)-9) 
 exec (@sql)