dbTalk Databases Forums  

Exec Sql Task Parameter to ## stored proc

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


Discuss Exec Sql Task Parameter to ## stored proc in the microsoft.public.sqlserver.dts forum.



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

Default Exec Sql Task Parameter to ## stored proc - 10-12-2006 , 11:34 AM






I have an SSIS package using an exec sql task being past a variable.
The variable is mapped to a parameter that is then passed to a ##
stored procedure within the sql task, and I am getting the following
error.

Unable to derive parameter information for a temporary stored
procedure.

The reason for wanting to use tempdb is that I need to dynamically
create a database given the database name.

Ideas?


if object_id('tempdb..##buildConstants ','U') is not null
DROP TABLE ##buildConstants
create table ##buildConstants
(
constantName varchar(128) Primary Key,
constantValue varchar(128)
)

GO

IF OBJECT_ID('Tempdb..##proc_insertBuildConstants','P ') is not null
drop procedure ##proc_insertBuildConstants

GO
CREATE PROCEDURE ##proc_insertBuildConstants
@constantName varchar(128),
@constantValue varchar(128)
AS
INSERT INTO ##buildConstants (constantName, constantValue)

VALUES
(
@constantName ,
@constantValue
)

The exec sql task looks like
exec ##proc_insertBuildConstants 'dbname', ?

This all works if I create a non-temporary stored procedure.

Thanks


Reply With Quote
  #2  
Old   
Arnie Rowland
 
Posts: n/a

Default Re: Exec Sql Task Parameter to ## stored proc - 10-12-2006 , 12:28 PM






While you may desire to use TempDb, the stored procedure, from what I see,
does not need to be a ##TempStored Procedure. (##buildConstants is a
'global' temp table, so if it exists, drop it, and create a new one.

So go with what you know works, a "non-temporary stored procedure".

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


"Marty" <frank0288 (AT) yahoo (DOT) com> wrote

Quote:
I have an SSIS package using an exec sql task being past a variable.
The variable is mapped to a parameter that is then passed to a ##
stored procedure within the sql task, and I am getting the following
error.

Unable to derive parameter information for a temporary stored
procedure.

The reason for wanting to use tempdb is that I need to dynamically
create a database given the database name.

Ideas?


if object_id('tempdb..##buildConstants ','U') is not null
DROP TABLE ##buildConstants
create table ##buildConstants
(
constantName varchar(128) Primary Key,
constantValue varchar(128)
)

GO

IF OBJECT_ID('Tempdb..##proc_insertBuildConstants','P ') is not null
drop procedure ##proc_insertBuildConstants

GO
CREATE PROCEDURE ##proc_insertBuildConstants
@constantName varchar(128),
@constantValue varchar(128)
AS
INSERT INTO ##buildConstants (constantName, constantValue)

VALUES
(
@constantName ,
@constantValue
)

The exec sql task looks like
exec ##proc_insertBuildConstants 'dbname', ?

This all works if I create a non-temporary stored procedure.

Thanks




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

Default Re: Exec Sql Task Parameter to ## stored proc - 10-12-2006 , 01:52 PM



Thanks Arnie, the problem is that my target db does not exist at the
begining of the package. I'm probably going to go with creating a
"non-temporary stored procedure" in master or temp. The real issue is
that I can't assign a parameter direct to a variable or do something
like

CREATE DATABASE ?
within the exec sql task.

I as looking for something a bit less brutish but I'll adapt.


Thanks again.


Arnie Rowland wrote:
Quote:
While you may desire to use TempDb, the stored procedure, from what I see,
does not need to be a ##TempStored Procedure. (##buildConstants is a
'global' temp table, so if it exists, drop it, and create a new one.

So go with what you know works, a "non-temporary stored procedure".

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


"Marty" <frank0288 (AT) yahoo (DOT) com> wrote in message
news:1160670865.474799.259110 (AT) m73g2000cwd (DOT) googlegroups.com...
I have an SSIS package using an exec sql task being past a variable.
The variable is mapped to a parameter that is then passed to a ##
stored procedure within the sql task, and I am getting the following
error.

Unable to derive parameter information for a temporary stored
procedure.

The reason for wanting to use tempdb is that I need to dynamically
create a database given the database name.

Ideas?


if object_id('tempdb..##buildConstants ','U') is not null
DROP TABLE ##buildConstants
create table ##buildConstants
(
constantName varchar(128) Primary Key,
constantValue varchar(128)
)

GO

IF OBJECT_ID('Tempdb..##proc_insertBuildConstants','P ') is not null
drop procedure ##proc_insertBuildConstants

GO
CREATE PROCEDURE ##proc_insertBuildConstants
@constantName varchar(128),
@constantValue varchar(128)
AS
INSERT INTO ##buildConstants (constantName, constantValue)

VALUES
(
@constantName ,
@constantValue
)

The exec sql task looks like
exec ##proc_insertBuildConstants 'dbname', ?

This all works if I create a non-temporary stored procedure.

Thanks



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.