Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 skipping lines in csv file

Author  Topic 

wealthmaker
Starting Member

4 Posts

Posted - 2012-03-01 : 12:11:00
hi everyone,

i'm new to sql and this might seem to be a simple task but i'm having issues finding a solution.

i'm using bulk insert to import a csv file into a table. the problem is that the csv file has a few lines that i would like to exclude. it's the first line, which i'm not having issues with, and a few lines below. all of them start and and with a specific character like this <exclude line>

is there a way for bulk insert to skip these lines? i would really hate to modify the csv file since it's generated using a script.

really appreciate your feedback.

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-01 : 12:12:34
No. So just do a delete as part of your processing

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

wealthmaker
Starting Member

4 Posts

Posted - 2012-03-01 : 12:14:02
hi brett,

when you say "just do a delete as part of your processing" you mean have an additional query to delete a specific lines that begin with specific characters?

thanks
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-01 : 12:15:22
ummm, yeah



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

wealthmaker
Starting Member

4 Posts

Posted - 2012-03-01 : 15:29:11
thanks i'll give it a try
Go to Top of Page
   

- Advertisement -