dbTalk Databases Forums  

insert based on global variable

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


Discuss insert based on global variable in the microsoft.public.sqlserver.dts forum.



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

Default insert based on global variable - 03-25-2005 , 09:23 AM






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


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

Default Re: insert based on global variable - 03-25-2005 , 09: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



"arthur" <alangham (AT) gmail (DOT) com> wrote

Quote:
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




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

Default Re: insert based on global variable - 03-25-2005 , 09:44 AM



ok, got it figured out. solution was very intuitive, however
implementing it was not!


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.