将表中的字段值作为表名进行查询(如图:ctable)


   
   
 
  

 
   create proc mytable
   @tb varchar(50)
   as
   exec ('select * from '+@tb)
   go

   declare @a varchar(50)
   --set @a='fitemss98'
   select @a=ctable from fitem where i_id=1
   exec mytable @a
   go

  


   

posted @ 2008-04-09 21:54  jdkbean  阅读(520)  评论(0)    收藏  举报