dbTalk Databases Forums  

Passing @@RowCount to Active X Script Count

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


Discuss Passing @@RowCount to Active X Script Count in the microsoft.public.sqlserver.dts forum.



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

Default Passing @@RowCount to Active X Script Count - 10-03-2003 , 07:18 PM






I am hoping someone out there can help me! I am a relative newbie to
DTS programming and am driving myself crazy trying to figure out how
to pass the number of records affected by a delete query I have
writting in an Execute SQL task to and Active X Script task. Here is
the SQL statement:

BEGIN TRANSACTION
ALTER TABLE MYTABLE DISABLE TRIGGER MyTrigger
DELETE FROM MyTable
select test = @@rowcount
ALTER TABLE MYTABLE ENABLE TRIGGER MyTrigger
COMMIT TRANSACTION

This allows me to specify an output parameter, which I assign to a
global variable. The problem is that no matter what I try the global
variable always says 0 after the task executes. Does anyone know what
I might be doing wrong and how to correct the problem?

Thanks,
Ryan

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

Default Re: Passing @@RowCount to Active X Script Count - 10-04-2003 , 01:24 AM






Add

SET NOCOUNT ON

to the top of the text i.e.

SET NOCOUNT ON
BEGIN TRANSACTION
ALTER TABLE MYTABLE DISABLE TRIGGER MyTrigger
DELETE FROM MyTable
select @@rowcount as RowsAffec
ALTER TABLE MYTABLE ENABLE TRIGGER MyTrigger
COMMIT TRANSACTION

--
--

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" <ryan.d.rembaum (AT) kp (DOT) org> wrote

Quote:
I am hoping someone out there can help me! I am a relative newbie to
DTS programming and am driving myself crazy trying to figure out how
to pass the number of records affected by a delete query I have
writting in an Execute SQL task to and Active X Script task. Here is
the SQL statement:

BEGIN TRANSACTION
ALTER TABLE MYTABLE DISABLE TRIGGER MyTrigger
DELETE FROM MyTable
select test = @@rowcount
ALTER TABLE MYTABLE ENABLE TRIGGER MyTrigger
COMMIT TRANSACTION

This allows me to specify an output parameter, which I assign to a
global variable. The problem is that no matter what I try the global
variable always says 0 after the task executes. Does anyone know what
I might be doing wrong and how to correct the problem?

Thanks,
Ryan



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.