x

Filename with datastamp and version number

I am creating an ssis package that copies and renames a file each time the package is run. I can get the filename to include the current date, however I would also like to include a version number just in case the package needs to be executed more than once in a day. (example: filename - date - 1, filename - date - 2)

Any suggestions?

more ▼

asked Mar 10, 2010 at 02:29 PM in Default

ssisjunkie gravatar image

ssisjunkie
11 1 1 1

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

Why not add the time too?

Filename = original
201003101200-Filename = execution at 12:00 on 10/Mar/2010
201003101300-Filename = execution at 13:00 on 10/Mar/2010
201003101600-Filename = execution at 16:00 on 10/Mar/2010
etc

more ▼

answered Mar 10, 2010 at 03:44 PM

Fatherjack gravatar image

Fatherjack ♦♦
42.6k 75 79 108

+1 I was going to suggest that, but instead I'll just vote up your answer. :)
Mar 10, 2010 at 04:01 PM Tom Staab
+1 - ditto with Tom
Mar 10, 2010 at 04:39 PM CirqueDeSQLeil
(comments are locked)
10|1200 characters needed characters left

Not sure if you can use it, but here's a nice way to copy and rename in one step. Depends on how your logic is for usefulness.

Can you check for the existence of the file and if it's not there you put it with a 1 on there. If it is there, you take the number it has and add 1 to it.

more ▼

answered Mar 10, 2010 at 03:06 PM

Jason Crider gravatar image

Jason Crider
453 10 10 12

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x937

asked: Mar 10, 2010 at 02:29 PM

Seen: 979 times

Last Updated: Mar 10, 2010 at 02:29 PM