dbTalk Databases Forums  

Parameters problem

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


Discuss Parameters problem in the microsoft.public.sqlserver.dts forum.



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

Default Parameters problem - 11-30-2004 , 10:17 PM






I'm trying to create a transform data task using the following query:
select * from Code_Authorizations_phi where Authorization_pkey in (Select
pkey from Code_Authorizations where dir_pkey = ?)

When I click the 'parameters' button or 'Parse Query' button I get the
following error:
Error Source: Microsoft OLE DB Provider for SQL Server
Error Description: Parameter Information cannot be derived from SQL
Statement with Sub-select Queries. Set parameter information before preparing
command.

Is there anyway that I can use a parameter as part of this sub-query?

Thanks!

Reply With Quote
  #2  
Old   
Ed
 
Posts: n/a

Default RE: Parameters problem - 12-01-2004 , 12:05 AM






I think the better way of doing it is to create a stored procedure
You may create a stored procedure and pass the paramemter and return the
result set like:

Create procedure ProcedureName(@CustomerID nvarchar(50)
as
Select * from customers where CustomerID in (Select customerid from Orders
where customerid = @CustomerID)

Then in the Execute SQL Task
Exec ProcedureName ?

Ed


"CBarry" wrote:

Quote:
I'm trying to create a transform data task using the following query:
select * from Code_Authorizations_phi where Authorization_pkey in (Select
pkey from Code_Authorizations where dir_pkey = ?)

When I click the 'parameters' button or 'Parse Query' button I get the
following error:
Error Source: Microsoft OLE DB Provider for SQL Server
Error Description: Parameter Information cannot be derived from SQL
Statement with Sub-select Queries. Set parameter information before preparing
command.

Is there anyway that I can use a parameter as part of this sub-query?

Thanks!

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

Default Re: Parameters problem - 12-01-2004 , 02:35 PM



You could of course use a Stored proc or function to do this but you can
also do this

Global Variables and SQL statements in DTS
(http://www.sqldts.com/default.aspx?205)

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"CBarry" <CBarry (AT) discussions (DOT) microsoft.com> wrote

Quote:
I'm trying to create a transform data task using the following query:
select * from Code_Authorizations_phi where Authorization_pkey in (Select
pkey from Code_Authorizations where dir_pkey = ?)

When I click the 'parameters' button or 'Parse Query' button I get the
following error:
Error Source: Microsoft OLE DB Provider for SQL Server
Error Description: Parameter Information cannot be derived from SQL
Statement with Sub-select Queries. Set parameter information before
preparing
command.

Is there anyway that I can use a parameter as part of this sub-query?

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.