Please visit our sponsor
UNKNOWN --************************************** -- Name: Read a text file into SQL SERVER -- Description:Using BULK INSERT TO READ A TEXT FILE into SQL SERVER and ELIMINATING THE USE of another text editor. -- By: Eli Leiba -- -- -- Inputs:@filename sysname (filename includes path) -- -- Returns:a recordset of the file lines in QUERY analyzer -- --Assumes:Usage : exec sp_readTextFile 'c:\autoexec.bat' -- --Side Effects:none --This code is copyrighted and has limited warranties. --Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.359/lngWId.5/qx/vb/scripts/ShowCode.htm --for details. --************************************** Create proc sp_readTextFile @filename sysname as begin set nocount on Create table #tempfile (line varchar(8000)) exec ('bulk insert #tempfile from "' + @filename + '"') select * from #tempfile drop table #tempfile End go