SQL - Read a txt file and separate rows by blanks

0

Hello friends I am trying to process some txt's that I receive from a system other than mine, I need to take this information and store it in a table within my SQL Server , the question is that my data It comes separated by 2 characters, very long blank spaces and zeros. Then I would like to separate each row within the file by spaces and then if to remove some zeros. The information I receive goes something like this:

What I am most interested in knowing is, how to separate for such long spaces and store these divisions in variables all from SQL , I have found a bit of such a function BULK INSERT So far I have only managed to separate a part of each row, and I need all the sections in different columns. This is my query so far

   
truncate table testtxt


bulk insert testtxt
from 'C:\Users\erpre\OneDrive\Escritorio\desk2\filetxt.txt'
with(
  fieldterminator = ' ', rowterminator = '0x0a'
)

select * from testtxt

  

The problem is that the espios have different units, some are from a space, 2 tabs etc .. Does anyone know if I can use several fieldterminator ?? Thank you all for your time.

    
asked by E.Rawrdríguez.Ophanim 11.07.2018 в 23:36
source

0 answers