Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

CSV import skips records

CSV import skips records

CSV import skips records

When I import a CSV into SQL Server 2005, my import is missing about half of the records.  I know why it's doing this, but not how to fix it.  I found that [Field5] of the first record in the CSV is an integer.  However, about half of the records have alphanumberic values in that field and SQL server is skipping any records in the CSV that are not numeric.

Anybody have an idea how I can define the import fields using BULK INSERT or to tell SQL server to use [nvarchar](255) as the default for imports?

Here is my [tTable] design, which matches the CSV fields:
    [Field1] [nvarchar](255) NULL,
    [Field2] [nvarchar](255) NULL,
    [Field3] [nvarchar](255) NULL,
    [Field4] [nvarchar](255) NULL,
    [Field5] [nvarchar](255) NULL,
    [Field5] [nvarchar](255) NULL,
    [Field6] [nvarchar](255) NULL,
    [Field7] [nvarchar](255) NULL

Here is my import code:
 FROM 'C:\FilePath\Filename.csv'
FIRSTROW        = 1,
MAXERRORS        = 0,
ROWTERMINATOR    = '0x0A'--'\n'


Dave idea

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close