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)
 Tricky Data Import

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-13 : 10:04:52
Nathan writes "Hello,

I am in a bit of a tricky quadmire with a task I have to implement with SQL Server 7, and VB. I am trying to create a Stored Procedure that the VB app will call to import the data from a CSV text file that the VB app creates.

The text file contains 3 of the 6 values required by the Table I am importing data into.

Example of Text File
1,1,23
1,2,54
1,3,24
1,4,76
2,1,12
2,2,65

The remaining columns are:

Date - SMALLDATETIME - this will be generated by the VB app and hopefully passed as an argument to the stored procedure. The SAME datetime value will be input with all records imported each time this procedure is executed.

The remaining two fields are generated by queries to other tables in the database, using the first two values of each line of the text file. They are both int values.

Main Table

DateTime SBus# Line# CountValue ProdCode RevCentre
----------------------------------------------------------------
Argument fromFile fromFile fromFile dbQuery dbQuery
Same fromFile fromFile fromFile dbQuery dbQuery
Same fromFile fromFile fromFile dbQuery dbQuery
Same fromFile fromFile fromFile dbQuery dbQuery
Same fromFile fromFile fromFile dbQuery dbQuery

The Key of the above Main Table is the first three columns.

So, I need to work out how to get all of the data I need, collated, and ready to insert into my Main table. I am having no luck as yet, using numerous tables, and SQL calls. I would really appreciate any direction that you may provide. If this is too complicated for the website, an email response is quite fine with me. Thanks.

Regards and fingers crossed,

Nathan Goss
nathang@crownltd.com.au"
   

- Advertisement -