By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,806 Members | 1,787 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,806 IT Pros & Developers. It's quick & easy.

Q: DTS and global variables

P: n/a
Using SQL2000, I have a DTS that takes data from MySQL to sqlserver, the
catch is I want to specify a specific range of dates.

How to use a global variable? At the moment I manually changes the dates and
jobs run on a daily basis.

sample sql statement from Mysql connection:
select *
from Table1
where date between '1/1/2004' and '6/30/2004'

select *
from Table1
where date between @fromdate and @todate

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Within a package you can assign global variables in any of several ways: In
an ActiveX Script task, a Dynamic Properties task or as the result of an
Execute SQL task for example. If you are invoking the package from code then
you can create and assign global variables in the the GlobalVariables
collection of the Package object. If you are running the package with the
DTSRUN utility then use the /A switch to assign global variables.

To use a global variable in a query you just need to put ? as a placeholder
in the properties dialog of the Execute SQL task. Then click on Parameters
and specify which global vars are assigned to which parameter in their
respective order.

David Portas
SQL Server MVP
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.