Upload csv Files Using SQL Server OpenRowSet Function
问题 I need to upload multiple files (file1, file2, file3...) into tables (Table1, table2, table3...) in a sql server DB using OpenRowset function. All the files are kept in C:\download I use the following query which works fine. INSERT INTO dbo.Table1 SELECT * from OpenRowset('MSDASQL','Driver={Microsoft Text Driver (*.txt;*.csv)};DefaultDir=C:\download;','select * from File1.csv' ) The question is how to pass the file name and table name as parameter. Thanks Tony for your answer. I have put the