dbTalk Databases Forums  

return numbers of inserted rows

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


Discuss return numbers of inserted rows in the microsoft.public.sqlserver.dts forum.



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

Default return numbers of inserted rows - 09-16-2003 , 06:54 AM






Hi,

Is it possible to have DTS tp return a "number of inserted rows".

What I want to do is

If there has been inserted some rows I would like to do one thing.
But if no rows has ben inserted i would like to do another thing.

Is this Posible??
And how if yes?

Best regards Morten

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

Default Re: return numbers of inserted rows - 09-16-2003 , 10:44 AM






Look at using an Active Script task and grabbing the RowsComplete property
of the DataPump task. You then look at workflow

Multiple Paths in Workflow
(http://www.sqldts.com/default.aspx?218)

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Morten Kruse" <morten (AT) kruss (DOT) dk> wrote

Quote:
Hi,

Is it possible to have DTS tp return a "number of inserted rows".

What I want to do is

If there has been inserted some rows I would like to do one thing.
But if no rows has ben inserted i would like to do another thing.

Is this Posible??
And how if yes?

Best regards Morten



Reply With Quote
  #3  
Old   
Ryan Waight
 
Posts: n/a

Default Re: return numbers of inserted rows - 09-16-2003 , 10:49 AM



I have a DTS package containing a 'Execute SQL Task' within the task i have
T-SQL to look for the number of affected rows. Example...

DECLARE @AffectedRows int
INSERT _TempTable
SELECT
stuff FROM table
WHERE stuff NOT IN (select stuff from OtherTable)

-- How many rows were affected..?
SELECT @AffectedRows = @@ROWCOUNT
-- If something happened perform next action
IF @AffectedRows > 0
BEGIN.........

--
HTH
Ryan Waight, MCDBA, MCSE

"Morten Kruse" <morten (AT) kruss (DOT) dk> wrote

Quote:
Hi,

Is it possible to have DTS tp return a "number of inserted rows".

What I want to do is

If there has been inserted some rows I would like to do one thing.
But if no rows has ben inserted i would like to do another thing.

Is this Posible??
And how if yes?

Best regards Morten



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

Default Re: return numbers of inserted rows - 09-16-2003 , 11:04 AM



Oh so you are using that task

OK So you get the amount of records affected yes ?

Is this "Perform Next action" another task in DTS or another SQL Statement.

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Ryan Waight" <Ryan_Waight (AT) nospam (DOT) hotmail.com> wrote

Quote:
I have a DTS package containing a 'Execute SQL Task' within the task i
have
T-SQL to look for the number of affected rows. Example...

DECLARE @AffectedRows int
INSERT _TempTable
SELECT
stuff FROM table
WHERE stuff NOT IN (select stuff from OtherTable)

-- How many rows were affected..?
SELECT @AffectedRows = @@ROWCOUNT
-- If something happened perform next action
IF @AffectedRows > 0
BEGIN.........

--
HTH
Ryan Waight, MCDBA, MCSE

"Morten Kruse" <morten (AT) kruss (DOT) dk> wrote in message
news:7328137a.0309160354.f4c0113 (AT) posting (DOT) google.com...
Hi,

Is it possible to have DTS tp return a "number of inserted rows".

What I want to do is

If there has been inserted some rows I would like to do one thing.
But if no rows has ben inserted i would like to do another thing.

Is this Posible??
And how if yes?

Best regards Morten





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.