all groups > sql server dts > may 2004 >
You're in the

sql server dts

group:

File Names In Table



File Names In Table DB_Princess
5/30/2004 10:46:03 AM
sql server dts: Guys

I have this great DTS package which I created from a looping example y'all pointed me towards. Just when I was about to put it into production, I was told that I should not have hardcoded my file names. Well, the purpose of the looping was that the file names changed daily and I wanted to pick up only the right 4 files for each day--not two versions of the same file at different times of the day, nor two files from different days, etc. So, It loops through the directory, looking for files which match the naming conventions, validates, then copies them over so and executes the datapump to import and a stored proc to massage and insert where needed. They have a table I can use to store these and subsequent table names, but I cannot figure out how to get them from the table and into my DTS. I am very familiar with VB, so I could use a recordset object, but I could use some examples that open the table, create global variables dynamically to hold the now unknown number of filenames. This way, the script task that finds the files can load them up for me so that the script task that copies them and executes the datapump can continue without having to be totally rewritten. I have to go in this afternoon or tomorrow, Memorial Day to get this working, so if anyone could help me, I sure would appreciate it

Re: File Names In Table DB_Princess
5/30/2004 4:21:01 PM
Allan

So kind of you to respond to me so quickly. I see how this is working, and I think I can use it to get the values out of the table alright, and I guess if I am appending the file names to a string that itself is a global variable...maybe separating each file with some type of delimiter, then I could loop through, parsing the string, and go pick up my files, right. Is that what this is suggesting? I wanted to figure out how to pick up data from the table and then create like an array of global variables or something, but this seems like it would do the trick. Is it okay to do it this way, or does it seem cheesy to you

Again, thanks for your kind response

Re: File Names In Table Allan Mitchell
5/30/2004 7:26:47 PM
are you wanting something like this?

How to loop through a global variable Rowset
(http://www.sqldts.com/default.aspx?298)

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


[quoted text, click to view]
pointed me towards. Just when I was about to put it into production, I was
told that I should not have hardcoded my file names. Well, the purpose of
the looping was that the file names changed daily and I wanted to pick up
only the right 4 files for each day--not two versions of the same file at
different times of the day, nor two files from different days, etc. So, It
loops through the directory, looking for files which match the naming
conventions, validates, then copies them over so and executes the datapump
to import and a stored proc to massage and insert where needed. They have a
table I can use to store these and subsequent table names, but I cannot
figure out how to get them from the table and into my DTS. I am very
familiar with VB, so I could use a recordset object, but I could use some
examples that open the table, create global variables dynamically to hold
the now unknown number of filenames. This way, the script task that finds
the files can load them up for me so that the script task that copies them
and executes the datapump can continue without having to be totally
rewritten. I have to go in this afternoon or tomorrow, Memorial Day to get
this working, so if anyone could help me, I sure would appreciate it.
[quoted text, click to view]

Re: File Names In Table Allan Mitchell
5/31/2004 7:53:23 AM
Nope sounds OK.

You can either use a delimited string or simply have a tuple per filename in
the database.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


[quoted text, click to view]
and I think I can use it to get the values out of the table alright, and I
guess if I am appending the file names to a string that itself is a global
variable...maybe separating each file with some type of delimiter, then I
could loop through, parsing the string, and go pick up my files, right. Is
that what this is suggesting? I wanted to figure out how to pick up data
from the table and then create like an array of global variables or
something, but this seems like it would do the trick. Is it okay to do it
this way, or does it seem cheesy to you?
[quoted text, click to view]

Re: File Names In Table anonymous NO[at]SPAM discussions.microsoft.com
5/31/2004 10:33:48 AM
Allan:

Well, I'm in the office on this fine Memorial Day, but I
cannot get the example to work in my package. First of
all, there seems to be a disconnect between me and the
data. There is no reference to the task that has the sql
string in it. It references a global variable named
RSTAbles which shows the type to be dispatch. I don't
have that as one of my choices and there seems to be no
relationship between RSTables global variable and my sql
task which is named getrstables. I don't know what I am
missing, but I can't get it to work. Also, we usually
use udl's, but if I'll take anything that will work at
this point. Any ideas?

Thanks again.

R
[quoted text, click to view]
Re: File Names In Table Allan Mitchell
5/31/2004 8:43:08 PM
So if I have your situation correct you need to pick up a rowset from a SQL
Server table which contains a list of filenames for you to use as data
sources. You have a text file source connection that you will be changing
from the rowset. You need to assign the rowset value each loop through the
rowset to the text file connection's Data Source property right?

First part = get the rowset
2nd part = start looping - pick up first row do assignment
3rd part - data pump
4th part - check for more rows. if yes then set #2 task to waiting.

The datapump part is not in there. Have a look here though

Looping, Importing and Archiving
(http://www.sqldts.com/default.aspx?246)

Yes it is a disconnected rowset



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


[quoted text, click to view]

AddThis Social Bookmark Button