dbTalk Databases Forums  

SQL Task: Insert statement with input parameter

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


Discuss SQL Task: Insert statement with input parameter in the microsoft.public.sqlserver.dts forum.



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

Default SQL Task: Insert statement with input parameter - 08-09-2006 , 10:51 AM






Hello, I want write an insert statement in a SQL task that I would like to be
able to pass an input paramter. For example:

insert into TableA (col1, col2)
select EmployeeID,?
from employees
where .........

Another variation

insert into TableA (col1, col2)
select EmployeeID, employeename
from employees
where employeeID = ?

The ? is an input parameter defined earlier in the package. This does not
work. Is there another way to do this?

Ric

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

Default Re: SQL Task: Insert statement with input parameter - 08-10-2006 , 05:31 AM






Hello Ric,

Quote:
Hello, I want write an insert statement in a SQL task that I would
like to be able to pass an input paramter. For example:

insert into TableA (col1, col2)
select EmployeeID,?
from employees
where .........
Another variation

insert into TableA (col1, col2)
select EmployeeID, employeename
from employees
where employeeID = ?
The ? is an input parameter defined earlier in the package. This does
not work. Is there another way to do this?

Ric

The first example should not work at all (you cannot put a param there),
but the second should be good; did you map your param correctly with a Global
Variable with a proper value?

Bye




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

Default Re: SQL Task: Insert statement with input parameter - 08-11-2006 , 02:21 AM



Hello,

I am not that familiar with DTS but in SSIS you can build an expression
for the sql statement you want to execute, there you can use
parameters.

Lilja

Ric wrote:
Quote:
Hello, I want write an insert statement in a SQL task that I would like to be
able to pass an input paramter. For example:

insert into TableA (col1, col2)
select EmployeeID,?
from employees
where .........

Another variation

insert into TableA (col1, col2)
select EmployeeID, employeename
from employees
where employeeID = ?

The ? is an input parameter defined earlier in the package. This does not
work. Is there another way to do this?

Ric


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.