dbTalk Databases Forums  

How to use a variable as input to SQL destination

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


Discuss How to use a variable as input to SQL destination in the microsoft.public.sqlserver.dts forum.



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

Default How to use a variable as input to SQL destination - 03-02-2006 , 01:04 PM






I can not figure this out in SSIS and its making me feel very stupid.




Scenario is to import several rows of data from Excel into SQL, but first I
have to get the next BatchID from a SQL table by inserting a new row.



I have the Excel import, transformations and import working fine without the
BatchID.




Now I need to figure out how / when I should execute a stored procedure to
get the next BatchID. Save that as a variable I assume, then run my import
from Excel and finally insert the results into SQL.




The thing I can't figure out is how I can use the variable that contains the
new ID. What am I missing.




Thanks for any help.




Mike



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

Default Re: How to use a variable as input to SQL destination - 03-03-2006 , 04:21 PM






Hello Mike,

So Insert a new Row using the dataflow task. Timestamp it
Now move to an ExecuteSQL task and grab that value into a Variable

http://www.sqlis.com/default.aspx?58

Now you can used parameterised queries in the next data flow task.


If this is not poassible then let us know what your actual scenario is.



Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
I can not figure this out in SSIS and its making me feel very stupid.

Scenario is to import several rows of data from Excel into SQL, but
first I have to get the next BatchID from a SQL table by inserting a
new row.

I have the Excel import, transformations and import working fine
without the BatchID.

Now I need to figure out how / when I should execute a stored
procedure to get the next BatchID. Save that as a variable I assume,
then run my import from Excel and finally insert the results into SQL.

The thing I can't figure out is how I can use the variable that
contains the new ID. What am I missing.

Thanks for any help.

Mike




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.