all groups > sql server dts > march 2005 >
You're in the

sql server dts

group:

insert based on global variable


insert based on global variable arthur
3/25/2005 7:23:30 AM
sql server dts:
sorry in advance for the newbie question.

i need to insert into a table using a global variable in a "where"
clause. so something like

insert into datasourceA.table1 (field1, field2)
select field1, field2
from datasourceB.table1
where field1 > aGlobalVariable

i can do the part without the where clause using a Transform Data Task,
however i'm not sure how to set the where condition.

thanks,

arthur
Re: insert based on global variable arthur
3/25/2005 7:44:00 AM
ok, got it figured out. solution was very intuitive, however
implementing it was not!
Re: insert based on global variable Denis
3/25/2005 10:41:41 AM
add an Execute SQL Task
paste this into the SQL statement box
insert into datasourceA.table1 (field1, field2)
select field1, field2
from datasourceB.table1
where field1 > ?

then click on parameters and select your global variable
you can have multiple parameters the first parameter is the first ? etc etc



[quoted text, click to view]

AddThis Social Bookmark Button