Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Using SSIS Variables with DBCC

Author  Topic 

mivey4
Yak Posting Veteran

66 Posts

Posted - 2011-07-28 : 07:23:14
I have an SSIS variable that I need to use with the DBCC CheckIdent command to reseed a loading table but for some odd reason the CheckIdent command chokes when I try to use the variable with it.

DBCC CheckIdent (RESEED, ?)

Where ? is the symbol for my mapped parameter. I know the value is in the variable because I've checked it.

If I use an actual value instead of the variable it works

DBCC CheckIdent (RESEED, 23)

What am I doing wrong???

Another observation:
========================

If I execute either of these statements in an Execute SQL Task, the results are successful:

CREATE TABLE #TEMP (Result INT)
INSERT INTO #TEMP (Result)
VALUES (2)

OR

DECLARE @Variable TABLE
(Result INT)
INSERT INTO @Variable (Result)
VALUES(2)


BUT, if I substitute the actual value with the SSIS Variable like this:

CREATE TABLE #TEMP (Result INT)
INSERT INTO #TEMP (Result)
VALUES (?)

OR

DECLARE @Variable TABLE
(Result INT)
INSERT INTO @Variable (Result)
VALUES(?)

I get the following error:
[Execute SQL Task] Error: Executing the query "CREATE TABLE #TEMP (Result INT)
INSERT INTO #TEMP ..." failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

If I use an existing physical table on the server and execute something like:

INSERT INTO Variable (Result)
VALUES (?)

Then the issue goes away.
I believe there are apparent limitations on the use of SSIS variables within the scope of the SQL Task component but a confirmation of this would be appreciated.


Oracle OCA
Adaptec ACSP
   

- Advertisement -