i want use select statement on the a table and inserting result into a temp table variable, but i don’t declare temp table with columns and i want use like this:
Declare #tmp table;
SELECT * INTO #tmp FROM myTable
this should also declare columns and data types for #tmp
You can do this simply without the DECLARE command – which is not valid for #temp tables anyway, only @table variables. Did you try just the following without trying to define #tmp first: