I need to perform a very large sql server insert from a c# application. Somewhere in the range of 20,000 through 50,000 records.
What is the fastest way through SQL server to perform the insert?
There are several options I know of, but I don't know which is the fastest.
insert into MyTable(column1, column2, ..., column*)
select 'value','value',...,'value'
union
select 'value','value',...,'value'
VS
insert into MyTable(column1, column2, ..., column*)
exec('select ''value'',''value'',...,''value'''
'select ''value'',''value'',...,''value''')
VS
bulk insert from a data file
VS
Any better way that you know of :)