SQL Server Bulk Insert Ingore or skip last row -
i'm using bulk insert script import number of flat files sql server
a few files end
-----------------------------------
so want or skip last row(s) or remove ------------------
in bulk insert. 1 of these options possible?
set @s = n'bulk insert ' + @t + ' ''' + @f + ''' (fieldterminator = ''|'', rowterminator = ''0x0a'', firstrow=2) '
lastrow = 1
doesn't work
the way can think of first bulk insert whole file single column table (as varchar(max)
). can identify last row, , use value in actual bulk insert
.
this not straight forward approach, don't think there (unless write custom solution in c# or java or whatever). maybe can use sqlcmd
first read number of lines in file, don't know how.
please note there connect item microsoft has closed. on page microsoft suggests using openrowset
solution, worthwhile try, doubt work in situation.
Comments
Post a Comment