8 Replies Latest reply: May 15, 2015 9:52 AM by Marcos Vicentin RSS

    Variable in SQL

      Hi,

       

      I´d like to create simething like this:

       

      set vtable = 'TAB01'

      [TABLE]:

      SQL

      declare @xtab varchar(500)

      declare @sql varchar(max)

      set @xtab= $(vtable)

      Set @sql = 'SELECT * from '+@xtab


      Exec(@sql);


      How can I do this?


      Thanks a lot