October 26, 2005 at 7:29 am
Hi,
I am trying to transfer data from text file to sql but not able to do it cuz it all spread around in text file. What can i do to transfer all data and then parse it!
Help!!
Thanks
October 26, 2005 at 7:33 am
If that is not properly delimited by a delimiter its not possible to import data from a text file using sql server.
with smiles
santhosh
October 26, 2005 at 7:40 am
is there a way that i can import it in to one column and then parse it!!
October 26, 2005 at 7:40 am
Unless it is fixed field format - or you insert each row into a (probably single column) staging table and subsequently parse out into your destination tables the values you need, if you feel more comfortable doing it this way around.
October 26, 2005 at 7:41 am
yes, that is straightforward, as long as you have a row terminator (eg lfcr)
October 26, 2005 at 7:41 am
Do you have any control over the text file you are trying to load?
October 26, 2005 at 7:42 am
i have the text file but it too big to modify. I even try taking in to different table and then parse it.
thanks
October 26, 2005 at 7:43 am
what is IFCR how can i do that
thanks
October 26, 2005 at 7:46 am
i got that in to one column but how can i query. The info in the table is customer information and i need to query their address and ssn!!
Thanks
October 26, 2005 at 7:59 am
You will need to find constants that exist in every row. Can you post a few rows of data in greek format (no real ssn's or addresses)
October 26, 2005 at 8:02 am
here is the data from the table
000 000000000000000000 0000000 00 1004319 10/25/2005 02 1004319
102 100431900103200083 0000001 01 121 RUCKS DRIVE ANGLETON TX 77515 1004319 1000467
102 100431900103200083 0000002 02 C P LUCAS REYES III 450638841
102 100431900103200083 0000004 05 06 BRAZORIA 102 10043190010
102 100431900103270417 0000002 02 C P DAVID LEBAKKEN KEITH 392665458
October 26, 2005 at 8:14 am
Interesting.
Your job sucks... :p
You need to examine the data more, if possible go back to source and get a data dictionary.
It looks like you have 5 or more tables rolled into one. I would guess if you extract the text and the 2nd column eg 100431900103200083 into a seperate table (based on the 01,02, 05 value) you may be able to get something.
But you really, really need to find the documentation for this - unless its a standard format someone knows about..?
November 8, 2005 at 8:42 am
is this a fixed length file?
take a look at using dts to import your fixed length file.
November 8, 2005 at 9:39 am
You could try importing the text file into MS Excel first. Then you can tell Excel where to create the columns to break up the data. Then, import the Excel file into SQL.
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply