dbTalk Databases Forums  

Active X

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


Discuss Active X in the microsoft.public.sqlserver.dts forum.



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

Default Active X - 02-12-2004 , 09:36 AM






Hi
I have a data pump , I have a Active X Script to populate
the destintation Table
I want to insert rows based on a condition
for eg Only If the salary >100000 I want to insert a row
other wise I want to fetch the next row and do the same
check and so on
The problem is the destination has NOT NULL Columns
So when I run the package it is saying cannot insert nulls
apparently its trying to insert a dummy row and since Not
null columns exist its throwing a exception
Any one knows how to debug this ?
PS: I cannot handle this in query need to do it in activex
Script
Thanks
Sunny


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

Default Re: Active X - 02-12-2004 , 10:16 AM






Can you specify the condition in the SourceSQLStatement of the datapump i.e.

SELECT <col list>
FROM TABLE
WHERE salary > 100000

That way you only have rows the qualify to begin with.

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Sunny" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi
I have a data pump , I have a Active X Script to populate
the destintation Table
I want to insert rows based on a condition
for eg Only If the salary >100000 I want to insert a row
other wise I want to fetch the next row and do the same
check and so on
The problem is the destination has NOT NULL Columns
So when I run the package it is saying cannot insert nulls
apparently its trying to insert a dummy row and since Not
null columns exist its throwing a exception
Any one knows how to debug this ?
PS: I cannot handle this in query need to do it in activex
Script
Thanks
Sunny




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

Default Re: Active X - 02-12-2004 , 10:56 AM



No I cant I just gave eg there There is lot of weird
business logic going on I prefer to handle it in active x
script
Quote:
-----Original Message-----
Can you specify the condition in the SourceSQLStatement
of the datapump i.e.

SELECT <col list
FROM TABLE
WHERE salary > 100000

That way you only have rows the qualify to begin with.

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Sunny" <anonymous (AT) discussions (DOT) microsoft.com> wrote in
message
news:f46101c3f17e$02f09380$a401280a (AT) phx (DOT) gbl...
Hi
I have a data pump , I have a Active X Script to
populate
the destintation Table
I want to insert rows based on a condition
for eg Only If the salary >100000 I want to insert a row
other wise I want to fetch the next row and do the same
check and so on
The problem is the destination has NOT NULL Columns
So when I run the package it is saying cannot insert
nulls
apparently its trying to insert a dummy row and since
Not
null columns exist its throwing a exception
Any one knows how to debug this ?
PS: I cannot handle this in query need to do it in
activex
Script
Thanks
Sunny



.


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

Default Re: Active X - 02-12-2004 , 11:08 AM



OK this works for me

CREATE TABLE Source(ID INT identity(1,1) ,salary money)
CREATE TABLE Destination(ID INT, salary money NOT NULL)

INSERT into Source(salary) VALUES(10)
INSERT into Source(salary) VALUES(110000)


ActiveX looks like this

Function Main()

IF DTSSource("salary") > 100000 THEN

DTSDestination("ID") = DTSSource("ID")
DTSDestination("salary") = DTSSource("salary")
Main = DTSTransformStat_OK

ELSE

Main = DTSTransformStat_SkipInsert

END IF

End Function

make sure you are also not running into this


Problems With IDENTITY() and the DataPump task.
(http://www.sqldts.com/default.aspx?293)

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Sunny" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
No I cant I just gave eg there There is lot of weird
business logic going on I prefer to handle it in active x
script
-----Original Message-----
Can you specify the condition in the SourceSQLStatement
of the datapump i.e.

SELECT <col list
FROM TABLE
WHERE salary > 100000

That way you only have rows the qualify to begin with.

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Sunny" <anonymous (AT) discussions (DOT) microsoft.com> wrote in
message
news:f46101c3f17e$02f09380$a401280a (AT) phx (DOT) gbl...
Hi
I have a data pump , I have a Active X Script to
populate
the destintation Table
I want to insert rows based on a condition
for eg Only If the salary >100000 I want to insert a row
other wise I want to fetch the next row and do the same
check and so on
The problem is the destination has NOT NULL Columns
So when I run the package it is saying cannot insert
nulls
apparently its trying to insert a dummy row and since
Not
null columns exist its throwing a exception
Any one knows how to debug this ?
PS: I cannot handle this in query need to do it in
activex
Script
Thanks
Sunny



.




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.