Stored Procedure to Open and Read a text file

Cyber Slueth Omega picture Cyber Slueth Omega · Dec 13, 2010 · Viewed 33.4k times · Source

I am looking for a stored procedure code that will open a text file, read in several thousand lines, and add the code to a table in the database. Is there a simple way to implement this in T-SQL?

Answer

Abe Miessler picture Abe Miessler · Dec 13, 2010

I would recommend looking at using SSIS. It's designed to do this sort of thing (especially if you need to do it on a regular basis).

Here is a good link that goes over reading a text file and inserting into the DB.