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
 General SQL Server Forums
 New to SQL Server Administration
 SSIS Help

Author  Topic 

PeeJay2583
Starting Member

40 Posts

Posted - 2011-05-16 : 08:12:32
Hi,


I have created a pacakge in SSIS to extract the data from excel and load into sql server table.

When the data in the excel sheet is less it still retrieves 304 rows and shows all other rows as NULL apart from the row which has data in excel.

I am looking for is that it should not show as NULL and only retreives those many rows having data in excel sheet.

Any help would be appreciated.

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-05-16 : 08:25:34
Add a filter to the daatflow to exclude rows where that value is null.
Or you can delete them after the import.

What happens if you have more than 304 rows in the spreadsheet? You should probably check that it is a problem with the end of spreadsheet row being detected rather than having a fixed range to import.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

PeeJay2583
Starting Member

40 Posts

Posted - 2011-05-16 : 08:43:58
It adds the rows to table if I have more than 304 rows in the spreadsheet.

I have added execute sql task in control flow to delete the rows containing NULL value and tried using either of queries mentioned below however it doesn't delete the rows containing NULL values.

"delete from Table1 where Name = NULL OR Name = ' ';

Query runs in the pacakge but its dosen't delete any rows in the table with NULL or blank value.
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2011-05-16 : 09:01:21
quote:
Originally posted by PeeJay2583

"delete from Table1 where Name = NULL OR Name = ' ';



delete from Table1 where Name IS NULL OR Name = ''

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page

PeeJay2583
Starting Member

40 Posts

Posted - 2011-05-16 : 09:05:19
It works thanks!
Go to Top of Page
   

- Advertisement -