As you've probably found out, SQL Server does not allow a variable in place of the table in a query. You're going to have to use Dynamic SQL to make this work:
DECLARE @cmd varchar(1000)
SET @cmd = 'SELECT * FROM ' + @tablename
EXECUTE (@cmd)
Check out the Execute command in the BOL for more info.
-Mike