dbTalk Databases Forums  

DTS from Excel with empty cell

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS from Excel with empty cell in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
oriki9999
 
Posts: n/a

Default DTS from Excel with empty cell - 12-15-2004 , 02:04 AM






I have currently trying to import an excel spreadsheet with named cells
to SQL thr DTS..

My problem is that how to I skip those cell that are empty in the
spreadsheet using DTS activeX?

This is what I tried? (I have tried checking for isNull)

Function Main()
'Check for not Null
If trim(DTSSource("Field A"))=NULL Then
Main = DTSTransformStat_SkipRow
Else
DTSDestination("FIELD_A") = DTSSource("Field A")
end if
Main = DTSTransformStat_OK

End Function

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DTS from Excel with empty cell - 12-15-2004 , 03:37 PM






Ok So you want to skip an import of an excel row if a field is empty

This works for me

Function Main()
IF IsNull(DTSSource("A") ) THEN
Main = DTSTransformStat_SkipRow
ELSE

DTSDestination("A") = DTSSource("A")
DTSDestination("B") = DTSSource("B")

Main = DTSTransformStat_OK
END IF

End Function


--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


<oriki9999> wrote

Quote:
I have currently trying to import an excel spreadsheet with named cells
to SQL thr DTS..

My problem is that how to I skip those cell that are empty in the
spreadsheet using DTS activeX?

This is what I tried? (I have tried checking for isNull)

Function Main()
'Check for not Null
If trim(DTSSource("Field A"))=NULL Then
Main = DTSTransformStat_SkipRow
Else
DTSDestination("FIELD_A") = DTSSource("Field A")
end if
Main = DTSTransformStat_OK

End Function

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply With Quote
  #3  
Old   
oriki9999
 
Posts: n/a

Default Re: DTS from Excel with empty cell - 12-15-2004 , 06:49 PM



I tried that also, but it did not work. I notice that as long as the
cells are format with border, it is not considered as Null.

Any one experience this?

~ oriki9999 ~


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DTS from Excel with empty cell - 12-16-2004 , 12:16 AM



<grin> you never mentioned a border.

What is the value of a cell with a border then?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


<oriki9999> wrote

Quote:
I tried that also, but it did not work. I notice that as long as the
cells are format with border, it is not considered as Null.

Any one experience this?

~ oriki9999 ~


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply With Quote
  #5  
Old   
oriki9999
 
Posts: n/a

Default Re: DTS from Excel with empty cell - 12-16-2004 , 01:54 AM



The cells with border are basically empty.

Basically this spreadsheet are meant for user to enter data that is
meant to be imported to the DB. As I am unsure the number of records the
user will enter, I have formatted extra rows of data with borders. And
hence the problem.

Thanks
~ oriki9999 ~


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.