Create proc [dbo].[readTextFile] @filename sysname,@OutputTest varchar(100)=null OUTPUT
as
begin
set nocount on
Create table #tempfile (line varchar(8000))
exec ('bulk insert #tempfile from "' + @filename + '"')
drop table #tempfile
End
using the proc above we can read the data into a temp file and work on it