Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    42

    Unanswered: how import into a table from a txt file????

    here is a txt file like:
    aaa 11 ny
    bbb 22 wer
    ccc 33 asdf
    (there are 5 spaces between fields and "\n" between two lines,
    a table named test :name char(3),age char(2),address char(5)
    how can i import into table "test" from the txt???

    the bcp will ask me so many parameters,how to set the parameters????

  2. #2
    Join Date
    Sep 2003
    Location
    Switzerland
    Posts
    443

    Re: how import into a table from a txt file????

    Use the bcp with -c and -t option

    Is 5 spaces common for all columns. If so, you should be able to use the -t option with "5spaces".

    If not, replace the spaces with a de-limiter like "," or "|" using shell.

    Vishi

    Originally posted by shawnlee
    here is a txt file like:
    aaa 11 ny
    bbb 22 wer
    ccc 33 asdf
    (there are 5 spaces between fields and "\n" between two lines,
    a table named test :name char(3),age char(2),address char(5)
    how can i import into table "test" from the txt???

    the bcp will ask me so many parameters,how to set the parameters????

Posting Permissions

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