how to insert values into temp table using select statement