How to use BULK insert to import data from file to SQL Server database?
I would like a stored procedure to import data from a .txt or .xls file to a database using SQL Server. I will use temporary tables to copy from the file and then I’ll transfer from the temporary tables to the database. Could you please give me an example of such a procedure? There are many ways to import data into SQL Server and what you choose depends greatly on your specific scenario. If you want to simply load contents of a text file into a temporary table, the BULK INSERT command should do the trick.
Related Questions
- Is there a single database file housing all the data, data definitions, stored procedures, security, table relationships, etc. as in Microsoft’s SQL server?
- How can I insert an entire text file into a SQL Server database table without having to read a row at a time?
- Most of our rolling stock is already in a basic Access database, can MRRM import data from another file?