I have a .txt file, I am suppose to put the data in the .txt file into a table in a database. I generally deal such type of task using Import Export Wizard (or) SSIS. But in this perticular .txt file there is no row delimeter "{CR}{LF}". Can any one suggest me the ways to put the row delimeter "{CR}{LF}" after every 40 charecters (As per the Spects) in that .txt file. So that I can load the data into the Data Base Table.
Hi, Maybe you can insert file content to a temp table and use this script in order to delimit content and insert it into another table.declare @content varchar(1000)='I generally deal such type of task using Import Export Wizard (or) SSIS I generally deal such type of task using Import Export Wizard (or) SSIS I generally deal such type of task using Import Export Wizard (or) SSIS'declare @counter int=LEN(@content)/40+1 declare @c int=0while (@counter>0) begin select SUBSTRING(@content,@c*40,40) set @c=@c+1 set @counter=@counter-1end
If the referred columns in the text file stands same without having any changes...then you can follow the suggested fix above. Also when you are trying to import from the text file you can refer the PREVIEW to see whether correct data is imported.