Link to home
Start Free TrialLog in
Avatar of CochiseCounty
CochiseCountyFlag for United States of America

asked on

Create DTS package with variables

I would like to create a DTS package to export data from SQL database to a text file. The name of the text file will be the value of a text box the users enter on the a web page. When the users click submit button, it will take the value in the text box and run the stored procedure that executes the DTS package. The dealine for my project is coming very soon, please help. Thanks
Avatar of Lori99
Lori99

You can do this by creating a global variable in your DTS package.  Open the package, go to Package Properties and you will see a Global Variables tab.  Give the variable a name, datatype and default value.  Add a Dynamic Properties task to your DTS package.  Right click on the task and go to Properties.  Click Add.  Expand Connections.. Text File.. OLE DB Properties.  Click on Data Source and then the Property Name.  Click Set.  For Source, choose Global Variable and then select the Global Variable name you set up.  Close all the windows.  

To use the Global Variable when you call the package, you must use the following format for the /A switch.

global variable name:data type identifier=value to use

For example:

dtsrun /NYourPackageName /AYourGlobalVariableName:8=c:\test\testfile.csv

The 8 is the data type identifier for a string.  The other data type identifiers are defined in the SQL Server Books Online under "dtsrun utility".
Avatar of CochiseCounty

ASKER

Hi Lori99, I am completely new in this subject....Would you please show me step by step how to add Dynamic Property to DTS package? I am using SQL 7.0. Thanks
Unfortunately, I don't believe the Dynamic Properties task exists in SQL 7.0 DTS.  I should have asked you before making the assumption you were on SQL 2000.  I don't have a SQL 7.0 installation available to figure out what you need to do and have only done this sort of thing on SQL 2000.  I imagine you would still set up the Global Variable with the file name and pass it to your package, but you will probably need to write some VB Script in the package to use the Global Variable to name your file.  Perhaps someone with experience in SQL 7.0 will be able to provide more information.
ASKER CERTIFIED SOLUTION
Avatar of Jay Toops
Jay Toops
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I really don't know what I am doing. Let me tell you about my project to see if you can give me some clues...

From the search page, users will enter id and search criteria,
then I have to write those search criteria to the database,
the next step is that I have to export those search criteria to a text file called outbox,
this text file will be used by another program (not created by me) to run a search (from a database (not sql) from a diffrent server),
after searching, the result will be post to another text file called Inbox,
then I have to import this Inbox text file to the SQL database and then display it on the web site.

The web application is on web server called server1 (internet) and the text files must be on server2 (sqlserver, not web server)

I don't have any problem with submit, retreive data from SQL to the web site, the thing I am confusing is the export/import from/to text file. I am thinking of using the id that users enter for the file name, that is the only way for me to tell which Inbox file goes with which Outbox file.


Please tell me which way is the simplest way to work on this project. Thanks



if you don't need to have the file in your sql server database just
read the file from the disk
using the file system object
and on your web page put a <PRE> tag
write all the lines of your file to the screen
then at the end close the </PRE>

Jay
Weird, I didn't get notification on this question way back when.  Ya, I agree you probably want to work with the user's name to make it unique.

I think I would also look at using XMLservices to do some of this and just use XML files....
HI.. could you award points for this?
Id really appreciate it..

Jay