Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009

    Unanswered: Can we give tablename dynamically in SELECT query..??

    Assume i have similar structure tables, (TableA, TableB, .. TableZ)

    Then how can i input the table name dynamically in the SELECT query..??

    Instead of giving
    Select * from TableA
    Select * from TableB
    Select * from TableZ

    is there a option like
    select * from Table[A-Z]
    Vikram RM

  2. #2
    Join Date
    Sep 2009

    you may do like this

    declare @sql varchar(200)
    select @sql='select * from sysobjects'
    exec (@sql)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts