How to Add Column Header

  • I receive semi colon delimited txt file and the column placements/position are always same. Currently, I am having to import it to excel and add column header to each. Any suggestions on how it can be automated?

  • Would you please be a little more specific what you're trying to do?

    Do you have to import the data into SQL Server? Does the target table already exist?

    What method do you use to get the data into SQL Server (if that's waht you'Re trying to do): SSIS, bcp, OPENROWSET, ...?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • JStevenson1 (4/22/2011)


    I receive semi colon delimited txt file and the column placements/position are always same. Currently, I am having to import it to excel and add column header to each. Any suggestions on how it can be automated?

    You are moving data from .txt to .xlsx ... why are you doing this? Why have you posted on a SQL Server forum when SQL Server has no apparent relevance to the content of your post?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • @Phil: the way I read it is that the OP needs Excel to add the column names manually and (guessing starts here) will import it into SQL Server based on the newly created Excel file. But I could be totally wrong...

    If it's just to add the column names I'd probably use the good old DOS approach: copy columnfile.txt + datafile.txt 😉



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • LutzM (4/23/2011)


    @Phil: the way I read it is that the OP needs Excel to add the column names manually and (guessing starts here) will import it into SQL Server based on the newly created Excel file. But I could be totally wrong...

    If it's just to add the column names I'd probably use the good old DOS approach: copy columnfile.txt + datafile.txt 😉

    🙂 yeah, I'm sure it's something like that. But why throw Excel into the equation at all (as you imply with your DOS suggestion)? Why worry about column names either? Just knowing the column ordinals should be enough ... Too many unknowns here.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

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

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