dbTalk Databases Forums  

SP + Output, fails to init Global var if DBCC is used

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


Discuss SP + Output, fails to init Global var if DBCC is used in the microsoft.public.sqlserver.dts forum.



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

Default SP + Output, fails to init Global var if DBCC is used - 06-11-2004 , 02:40 PM






Hi,

I've had a strange problem. Can anyone confirm?
SQL2K, version: 8.00.760

Stored procedure:
=================
CREATE PROCEDURE dbo.myProc
@myID int OUTPUT
AS
SET NOCOUNT ON
SET @myID = 123
--reseed with myTable with new Identity
DBCC CHECKIDENT ('myTable', RESEED, @myID)
GO

In the DTS, SQL Task
=====================
DECLARE @myID int
EXEC myProc @myID OUTPUT
SELECT @myID AS MaxNewID

I initialize a global variable with the result of the select, as instructed
here: http://www.sqldts.com/default.aspx?234

Problem:
========
When DBCC is commented out in the SP code, global var is init OK. When DBCC
is executed, the DTS skip the global var initialization (which then always
keeps the previous value).

Question:
=========
What I did wrong and how to solve this?

Thanks in advance.

Zirco.

Reply With Quote
  #2  
Old   
Nigel Rivett
 
Posts: n/a

Default RE: SP + Output, fails to init Global var if DBCC is used - 06-14-2004 , 10:10 PM






Doesn't help but dbcc checkident produces a resultset which I guess is what is upsetting the sql task.


"Zirco" wrote:

Quote:
Hi,

I've had a strange problem. Can anyone confirm?
SQL2K, version: 8.00.760

Stored procedure:
=================
CREATE PROCEDURE dbo.myProc
@myID int OUTPUT
AS
SET NOCOUNT ON
SET @myID = 123
--reseed with myTable with new Identity
DBCC CHECKIDENT ('myTable', RESEED, @myID)
GO

In the DTS, SQL Task
=====================
DECLARE @myID int
EXEC myProc @myID OUTPUT
SELECT @myID AS MaxNewID

I initialize a global variable with the result of the select, as instructed
here: http://www.sqldts.com/default.aspx?234

Problem:
========
When DBCC is commented out in the SP code, global var is init OK. When DBCC
is executed, the DTS skip the global var initialization (which then always
keeps the previous value).

Question:
=========
What I did wrong and how to solve this?

Thanks in advance.

Zirco.


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.