Line breaks issue during import from excel file

  • antros48

    SSC Rookie

    Points: 32

    Hi all,

    Newbie to sql management studio.

    I import data from excel and some cells contain line breaks. I would like these breaks to be copied the same way in the database corresponding field. Is there anything i have to apply on the query or in the options settings of the database?

    Any help appreciated.

     

  • Lowell

    SSC Guru

    Points: 323444

    the data would have to feature text qualifiers(typically dbl quotes) in order to do that; doe sit?

    for example a csv that looks like this:

    "col1","col2","col3"
    "data1","data2","data 3
    that features
    multiple lines"

    if it does, you can use the SSMS Import Wizard, and simply make sure you select the text qualifier to be the dbl quote:

     

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • drew.allen

    SSC Guru

    Points: 76688

    He mentions importing from Excel, not from a CSV.  I think it should be fairly straightforward to import from Excel, but it's been a long time since I tried it.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • Lowell

    SSC Guru

    Points: 323444

    agreed, but I cannot tell you how many people I've met who consider CSV to be excel, since it's often the default  application for CSV.

    add in the fact that he's having text qualifier issues on import, which wouldn't happen with actual xls/xlsx files, and I think I've got a good preliminary guess.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply