When I do the import file manually from table import dropdown this text document populates the table normally. But when I use Bulk Insert I get no records returned message. I tried this with a primary key auto mumber and without. Same result. My front end is Microsoft ADP and the bake end is SQL Server 2008. Running this as a stored procedure. The real message is the procedure finshed normally but with no records. I opened the text file in a hex editor and confirmed there is a cr and lf for each line but there was two at the EOF I removed one but the result is still the same. Please help I've been all over the internet and can't find a solution. Been working on this for several days. If you don't have an answer maybe there is another solution. I know there are programmers out there who are importing thousands of records daily how are they doing it?
Stored Procedure:
AS
CREATE TABLE EDI3
(
Field1 varchar(30), Field2 varchar(30), Field3 varchar(30), Field4 varchar(30), Field5 varchar(30), Field6 varchar(30), Field7 varchar(30), Field8 varchar(30), Field9 varchar(30), Field10 varchar(30), Field11 varchar(30), Field12 varchar(30),
Field13 varchar(30), Field14 varchar(30), Field15 varchar(30), Field16 varchar(30), Field17 varchar(30), Field18 varchar(30), Field19 varchar(30), Field20 varchar(30), Field21 varchar(30), Field22 varchar(30), Field23 varchar(30), Field24 varchar(30)
)
declare @sql1 varchar(1000), @path varchar(255)
set @path = '\\Elite\c_dns\EDITest\'
--
set @sql1 = 'BULK INSERT edi3
FROM ' @Path + 'edi.txt' )
+ ' WITH (
FIELDTERMINATOR = "*'',
ROWTERMINATOR = ' \n')
exec(@sql1)
Text File:
ST*322*000124314
Q5*A*20010919*1215*LT**NASHVILLE*TN
N7*CSXU*982744*********CN*REAZ***4800*****114*98
DTM*140*20010919*142543*ET
W2*CSXU*982744*WINE*CN*L
NA***BRAN* 4741*F
R4*5*SL*434300
N1*RO*OAKLAND*20*876430
N1*RD*MIAMI*20*499600
N1*SH*CSXINTERM
N9*BM*5646445
N9*WY*186502**20010913
N9*UT*Q12519
SE*14*000124314
Stored Procedure:
AS
CREATE TABLE EDI3
(
Field1 varchar(30), Field2 varchar(30), Field3 varchar(30), Field4 varchar(30), Field5 varchar(30), Field6 varchar(30), Field7 varchar(30), Field8 varchar(30), Field9 varchar(30), Field10 varchar(30), Field11 varchar(30), Field12 varchar(30),
Field13 varchar(30), Field14 varchar(30), Field15 varchar(30), Field16 varchar(30), Field17 varchar(30), Field18 varchar(30), Field19 varchar(30), Field20 varchar(30), Field21 varchar(30), Field22 varchar(30), Field23 varchar(30), Field24 varchar(30)
)
declare @sql1 varchar(1000), @path varchar(255)
set @path = '\\Elite\c_dns\EDITest\'
--
set @sql1 = 'BULK INSERT edi3
FROM ' @Path + 'edi.txt' )
+ ' WITH (
FIELDTERMINATOR = "*'',
ROWTERMINATOR = ' \n')
exec(@sql1)
Text File:
ST*322*000124314
Q5*A*20010919*1215*LT**NASHVILLE*TN
N7*CSXU*982744*********CN*REAZ***4800*****114*98
DTM*140*20010919*142543*ET
W2*CSXU*982744*WINE*CN*L
NA***BRAN* 4741*F
R4*5*SL*434300
N1*RO*OAKLAND*20*876430
N1*RD*MIAMI*20*499600
N1*SH*CSXINTERM
N9*BM*5646445
N9*WY*186502**20010913
N9*UT*Q12519
SE*14*000124314