Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 2 part question on Importing files

Author  Topic 

SQLServerDBA_Dan
Aged Yak Warrior

752 Posts

Posted - 2004-02-06 : 15:32:12
These questions are about importing files with uneven record lengths into SQL Server 2k.

uneven file example1:
Header record,data,data,data
Actual data record,data,data,data,data,data,data
trailer record,data,data


uneven file example2:
Header record,data,data,data
Actual data record type 1,data,data,data,data,data,data
Actual data record type 2,data,data,data,data,data,data,data,data,data,data,data,data,data
Actual data record type 3,data,data
trailer record,data,data



Question 1: What is the specific name of this type of file? I have seen them mostly used with unix/informix applications.

Question 2: Short of writing VB code to parse the file, How would you go about importing it into SQL Server? If I try to just import the records I get this error: "Too many columns found in the current row;non-whitespace characters were found after the last defined column's data." I know MS Access will handle the import. But then I would need to use access to import the file and then DTS the access table into SQL Server 2k. That just seems wrong to me...


Any help would be very nice.


Thanks


Daniel
SQL Server DBA

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-02-06 : 15:42:04
Answer 1: I don't know
Answer 2: One option might be to import the row as a single field value, (Not comma delimited) and parse it with T-SQL.
Go to Top of Page
   

- Advertisement -