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)
 DTS and Excel (NULL values) issue

Author  Topic 

THNQdigital
Starting Member

15 Posts

Posted - 2005-05-03 : 17:10:02
hi,

i have a package thAt loads an excel file to a table. Simple and works just fine.

Let's say my excel file has 10 rows and i run the dts and 10 rows get loaded.

Now, 2nd time i open the excel file and delete last 8 rows and retain only first 2 rows and save the file. I run the DTS package again and it says 10 rows loaded again.. when i see the table, NULL is loaded in the rest of the 8 rows..

how can avoid this..? please let me know.

Thanks for the help

THNQdigital

jsiedliski
Yak Posting Veteran

61 Posts

Posted - 2005-05-03 : 20:03:17
Are you actually deleting the ROWS or just the data in the rows? The JET Driver (driver SQL uses to connect to the Excel file) thinks there is still data in those rows. I think if you truly deleted the rows (and you may want to delete several rows below the 8 as well), ti should go away.

A seccond option would be to write a delete statement which executes after the import is done. Assuming you have 4 columns

DELETE FROM my_table WHERE a IS NULL AND b IS NULL AND c IS NULL and d IS NULL.

That way you do not have to worry about the JET driver thinking there are rows which you do not consider legitimate records.

:)
Go to Top of Page

THNQdigital
Starting Member

15 Posts

Posted - 2005-05-04 : 11:17:31
Wonderful.. That was the problem.. and i like the way to check for nulls and delete them .. that way you don't care how JET is treating excel values.. good stuff.. and works well.. thanks

THNQdigital
Go to Top of Page
   

- Advertisement -