dbTalk Databases Forums  

Set destination column to NULL if incorrect data type?

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


Discuss Set destination column to NULL if incorrect data type? in the microsoft.public.sqlserver.dts forum.



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

Default Set destination column to NULL if incorrect data type? - 04-15-2005 , 10:43 AM






Is there a way to set the destination column to NULL if there is a data type
mismatch, like trying to insert a string into a numeric type column? Thanks.

Reply With Quote
  #2  
Old   
Ed
 
Posts: n/a

Default RE: Set destination column to NULL if incorrect data type? - 04-17-2005 , 02:57 AM






in the ActiveX, you can put

dim checking

checking = DTSSource("Col002")
if isnumeric(testing) = false Then
DTSDestination("test2") = null
Else
DTSDestination("test2") = DTSSource("Col002")
End if

Ed

"Stefan Wrobel" wrote:

Quote:
Is there a way to set the destination column to NULL if there is a data type
mismatch, like trying to insert a string into a numeric type column? Thanks.

Reply With Quote
  #3  
Old   
Stefan Wrobel
 
Posts: n/a

Default RE: Set destination column to NULL if incorrect data type? - 04-18-2005 , 11:21 AM



Right, but the data type of the destination column varies, so it won't always
be isnumeric that i'm checking for. Thanks for the response, any other ideas?

"Ed" wrote:

Quote:
in the ActiveX, you can put

dim checking

checking = DTSSource("Col002")
if isnumeric(testing) = false Then
DTSDestination("test2") = null
Else
DTSDestination("test2") = DTSSource("Col002")
End if

Ed

"Stefan Wrobel" wrote:

Is there a way to set the destination column to NULL if there is a data type
mismatch, like trying to insert a string into a numeric type column? Thanks.

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

Default Re: Set destination column to NULL if incorrect data type? - 04-18-2005 , 01:45 PM



I do not think this will be possible because as you say you have no idea what is the source and what is the destination datatypes.
Also you may not want to abort the insert because the datatypes and data may be implicitly convertable

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Stefan Wrobel" <StefanWrobel (AT) discussions (DOT) microsoft.com> wrote

Quote:
Right, but the data type of the destination column varies, so it won't always
be isnumeric that i'm checking for. Thanks for the response, any other ideas?

"Ed" wrote:

in the ActiveX, you can put

dim checking

checking = DTSSource("Col002")
if isnumeric(testing) = false Then
DTSDestination("test2") = null
Else
DTSDestination("test2") = DTSSource("Col002")
End if

Ed

"Stefan Wrobel" wrote:

Is there a way to set the destination column to NULL if there is a data type
mismatch, like trying to insert a string into a numeric type column? Thanks.



Reply With Quote
  #5  
Old   
Stefan Wrobel
 
Posts: n/a

Default Re: Set destination column to NULL if incorrect data type? - 04-18-2005 , 02:11 PM



Isn't there just some exception I can catch or something? I just wish this
was .Net...

"Allan Mitchell" wrote:

Quote:
I do not think this will be possible because as you say you have no idea what is the source and what is the destination datatypes.
Also you may not want to abort the insert because the datatypes and data may be implicitly convertable

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Stefan Wrobel" <StefanWrobel (AT) discussions (DOT) microsoft.com> wrote

Right, but the data type of the destination column varies, so it won't always
be isnumeric that i'm checking for. Thanks for the response, any other ideas?

"Ed" wrote:

in the ActiveX, you can put

dim checking

checking = DTSSource("Col002")
if isnumeric(testing) = false Then
DTSDestination("test2") = null
Else
DTSDestination("test2") = DTSSource("Col002")
End if

Ed

"Stefan Wrobel" wrote:

Is there a way to set the destination column to NULL if there is a data type
mismatch, like trying to insert a string into a numeric type column? Thanks.




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.