Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

BCP in tab separated file to a table

$
0
0
Hello guysI am trying to bcp a log file into a table. Fields are "tab" separated and rows are "crlf" separated.The rows of the file are uneven, in the sense, one row might have 35 tabs and the next one might have 10.The table i am trying to insert to has 40 columns (maximum no.of columns i calculated from the log file). I tried both these commandsBCP.EXE TEST.dbo.LOG IN E:\syslog.TXT -c -e error.txt -T -SBCP.EXE TEST.dbo.LOG IN E:\syslog.TXT -c -t\t -r\r -e error.txt -T -S (i also tried using a format file from table)when I run this, the table is loaded with data but not in the intended way.This is what I have from the tableIf the 1st line in the text file has 35 columns and the row ends after it, in the table the 1st row has correct info until the 35th column and instead of going to the next row for the next line in file, it continues to use the next 5 columns in table before it goes to the next row. I think its not getting the row delimiter. How do I force it to next line. Can you please help me figure this out.Thanks

Viewing all articles
Browse latest Browse all 3145

Trending Articles