|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
sql server 2000
The problem is as follows:
Bulk data needs to be imported from a ".dat" file into SQL server 2000. The data file consists of attrbutes that can be identified by record positions that are given in the record layout file. There are no column delimiters and the colmn values are continuous. Thanks, J Last edited by g_janhavi : March 14th, 2004 at 06:32 PM. Reason: detailed description |
|
#2
|
|||
|
|||
|
so you're trying to import File A but the Position are in File b, right?
try to do it in C# if you can, it will much easier than SQL...but if you cann't... here's a few hints: import the file B with customer delimiter (redo the file if you must) put it in a table ( with one record and has many fields has there is in the file...hope you got <30!) create Table B as Pos_start_field_1 int, Pos_end_field_1 int, Pos_start_field_2 int, Pos_end_field_2 int, ... then import the File A into a temp table (Table A)into one field varchar (hope your line is <8000) then cross join your 2 table and use the function substring(field_coming_from_file_A,Pos_start_field_1,Pos_end_field_1) as field_1, substring(field_coming_from_file_A,Pos_start_field_2,Pos_end_field_2) as field_2, and so on... there must be a simplier solution ..but this is the only one I can think about right now Last edited by sypher : March 20th, 2004 at 04:42 PM. |
|
#3
|
|||
|
|||
|
Thanks for you help Sypher.
I solved the problem using DTS. |
|
#4
|
|||
|
|||
|
what did you do?..I'm curious
|
|
#5
|
|||
|
|||
|
DTS gives an option of using "Text file" as a datasource...use the same for .dat file. Then DTS recognizes that the source has no delimiters and is fixed length. The columns then need to be segregated using the record layout positions. Write all the columns into a new table (DTS will create one).
|
|
#6
|
|||
|
|||
|
I just assume your already try that...next time I'll ask the it..
![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > sql server 2000 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|