Results 1 to 17 of 17

Thread: problem importing CSV file to SQL 2k

Hybrid View

  1. #1
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: problem importing CSV file to SQL 2k

    I would personally load the file in Excel and write a quick macro to add quotes to all cells, before re-saving as CSV and doing the import with delimiters... untested macro example:
    VB Code:
    1. Dim CurrCell as Range
    2.   For Each CurrCell In ThisWorkBook.WorkSheets("[u]Sheet1[/u]").UsedRange
    3.     CurrCell.Text = """" & CurrCell.Text & """"
    4.   Next CurrCell

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: problem importing CSV file to SQL 2k

    Quote Originally Posted by si_the_geek
    I would personally load the file in Excel and write a quick macro to add quotes to all cells, before re-saving as CSV and doing the import with delimiters... untested macro example:
    VB Code:
    1. Dim CurrCell as Range
    2.   For Each CurrCell In ThisWorkBook.WorkSheets("[u]Sheet1[/u]").UsedRange
    3.     CurrCell.Text = """" & CurrCell.Text & """"
    4.   Next CurrCell
    Is that necessary? I mean, isn't there an option when saving as CSV to add text quote identifiers? It's been a while since I've had to make a csv through Excel, but I thought I remembered something to that effect in there.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: problem importing CSV file to SQL 2k

    Quote Originally Posted by techgnome
    Is that necessary? I mean, isn't there an option when saving as CSV to add text quote identifiers? It's been a while since I've had to make a csv through Excel, but I thought I remembered something to that effect in there.
    I did a quick test and didn't get any options (even in the Save As dialog), but it probably is an option somewhere!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width