dbTalk Databases Forums  

Re: using variables in DB2 dts

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


Discuss Re: using variables in DB2 dts in the microsoft.public.sqlserver.dts forum.



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

Default Re: using variables in DB2 dts - 09-18-2004 , 05:40 AM






In article <E52D8824-8E87-4BD2-9B62-DEBBC41F2571 (AT) microsoft (DOT) com>, Mike w.
wrote:
Quote:
I have a dts package that uses SQL to get data from a DB2 database.
How can use variables within the dts SQL?

I need to have the SQL Server equivilent of this in the dts
Declare @CurrentMonth as varchar(15)
Declare @NextMonth as varchar(15)

Set @CurrentMonth = Cast(Month(DateAdd(m,-1,getDate()))as varchar(2))
+ '/01/' + Cast(Year(DateAdd(m,-1,getDate()))as varchar(4))
Set @NextMonth = DateAdd(m,1,@CurrentMonth)

The above code isn't working when I add it to the dts SQL statement.

thanks,

mike w.

You use variables like this

SELECT ............ FROM table
WHERE col1 = ? And col2 = ?

You can then, using the parmeters button map the ? To a global variable.

The use of ? Is also driver specific so you may/may not have problems
doing this so you may want to look at doing it this way.

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





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.