How to read in a text file from a stored procedure

I need to read the log file generated by the SSIS package in my stored procedure.

Is there a good way to do this?

I tried using this code , but it shows the contents of my file as jibberish. Is there some kind of encoding problem that it doesn't handle? Is there an easier way?

+3
source share
3 answers

Have you tried the inline insert? For instance:

create table #TempTable (line varchar(256))
bulk insert #TempTable from 'c:\logfile.txt'
+5
source

You can try

select * from OPENROWSET(BULK N'C:\logfile.txt', SINGLE_BLOB)
+1
source

, , !

, , , , .

, , , CLR SQL Server. , .NET

MSDN Link 1 MSDN 2

, , , CLR SQL Server

0

Source: https://habr.com/ru/post/1763621/


All Articles