software_developer_kk mentioned nothing about temporary tables.
I recommend that you use dynamic SQL
Example:
DECLARE @tname sysname
SELECT TOP 1 @tname = table_name FROM Information_Schema.Tables
DECLARE @SqlString varchar(8000)
SELECT @SqlString = 'SELECT * FROM [' + @tname + ']'
EXEC (@SqlString )
-- Generally you should avoid Select * but in this case you may not know the column names
-- Generally you should avoid Select without where but a where is hard to do when you may not know the column names
-- Generally sp_ExecuteSQL is better than EXEC but for this example it does not matter, but if pass in parameters then it is recommended to use sp_executesql
David Lundell
Principal Consultant and Trainer
www.mutuallybeneficial.com