Results 1 to 2 of 2

Thread: help needed!

  1. #1
    Join Date
    Dec 2010
    Posts
    3

    Unanswered: help needed!

    Hey peeps i am an sql novice and would like to ask for some assistance!
    i have succesfully read the contents of a horizontal filled text file and inserted them into sql using Bulk insert! but my aim is to make this horizontal table a vertical one!
    Text file:
    flex,flex1,flex2
    0,1,2
    in SQL:
    flex 0
    flex1 1
    flex2 2
    should i first load it horizontally and then change it to vertical? and how?
    or is there a way to directly read from horizontal text file and insert vertically?
    thank you for ur help!

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    select 'flex' as flextype, flex as flexvalue from yourtable
    union all
    select 'flex1' as flextype, flex1 as flexvalue from yourtable
    union all
    select 'flex2' as flextype, flex2 as flexvalue from yourtable
    .
    .
    .
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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