I have a stored procedure which I use to load csv files to SQL Server. This will initially bulk insert the file into a global temporary table then at the end it will do:
select cast(column1 as int) [column1], column2, column3... into table from ##temptable
and then proceeds to drop the
Before the query
select into table from ##temptable I run a series of
select queries on the temporary table to determine what type the columns should be (and I'm confident this works properly).
Note that having a table (either normal or temporary) before creating the final output table is essential for the stored procedure.
What I'd like to know is if I'm better off using a global temporary table or if I should use a normal table or does it make no difference?
I've seen several articles about the differences between temporary tables and table variables but I've seen nothing when it comes to comparing global temporary tables to normal tables and it's difficult for me to test this properly in my environment.