MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old March 14th, 2004, 12:42 PM
g_janhavi g_janhavi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 8 g_janhavi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old March 20th, 2004, 04:31 PM
sypher sypher is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Montreal
Posts: 92 sypher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 10 sec
Reputation Power: 5
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.

Reply With Quote
  #3  
Old March 24th, 2004, 01:18 PM
g_janhavi g_janhavi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 8 g_janhavi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for you help Sypher.

I solved the problem using DTS.

Reply With Quote
  #4  
Old March 24th, 2004, 04:42 PM
sypher sypher is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Montreal
Posts: 92 sypher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 10 sec
Reputation Power: 5
what did you do?..I'm curious

Reply With Quote
  #5  
Old March 24th, 2004, 06:28 PM
g_janhavi g_janhavi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 8 g_janhavi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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).

Reply With Quote
  #6  
Old March 24th, 2004, 06:39 PM
sypher sypher is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Montreal
Posts: 92 sypher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 10 sec
Reputation Power: 5
I just assume your already try that...next time I'll ask the it..

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > sql server 2000


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway