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

Filename Increments

benchpolo
100+
P: 142
I have an automated process that I need to produce incremental filenames so that when the sql process runs multiple times the file will be incremented, but I cannot find or figure out how to write this code.

For example, arcca_daily_incoming_1.asc , this is the filename for the first run then when the process executes again on the same the the filename would be arcca_daily_incoming_2.asc then arcca_daily_incoming_3.asc .. make sense?

Can someone assist me with the code or point me where I can mirror the code? I have never written this kind of process before.

You assitance will be appreciated.

Thanks.
Jul 8 '09 #1
Share this Question
Share on Google+
4 Replies


ck9663
Expert 2.5K+
P: 2,878
Will the process execute once, meaning all these files will be created at once? Or your process will execute in a defined frequency that it will start from the last file created from the previous process and go from there?


--- CK
Jul 8 '09 #2

benchpolo
100+
P: 142
The process is automated so if it runs succesfully for that day it will be arcca_daily_incoming_1.asc, but if the automated process is run manually it should not create arcca_daily_incoming_1.asc instead it should increment to arcca_daily_incoming_2.asc
Jul 8 '09 #3

ck9663
Expert 2.5K+
P: 2,878
In that case, you have to check first if there are existing files on your target folder. If there are, you have grab the last increment number and start from there, if no file are existing, start from 1, then loop. You have to do all this using dynamic query.

Happy Coding!

--- CK
Jul 8 '09 #4

Expert 100+
P: 145
Perhaps it would be more useful if you used a time/date combination to name your erudite files. As your process continues to run, filename_#.ext becomes less useful to placing the file name into a useful context such as when an event/error occurred.

That's it. I'm out of change.

That was my last two cents.
Jul 29 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.