SqlShare.com Logo
 
Skip Navigation Links
Home
Video List
Events
Classes
About Us
Login / Register
Subscribe RSS Feed 

Confio Ignite

Adding a Time Stamp to a File Name in SSIS

This videos show you how to dynamically add a date stamp to a file name using SQL Server Integration Services expressions. It's a great example of how to set a property using an expression, with possible applications ranging far beyond just adding a date stamp.

Duration:
6 mins 9 secs
Skill Level:
200
Rating:
4.49 out of 5
Publish Date:
December 01, 2008
Adding a Time Stamp to a File Name in SSIS You must be logged in to view this video.  
Bookmark and Share
 
1=Poor, 3=Good, 5=Excellent

About the Author

Image of Brian Knight
Owner of Pragmatic Works :: Brian Knight, SQL Server MVP, MCSE, MCDBA, is the co-founder of Jumpstart TV and SQLServerCentral.com. Brian has written and co-written 9 technical books. Brian has spoken at conferences like PASS, TechEd and Connections. Brian develops solutions with Pragmatic Works to migrate DTS packages to SSIS.

References

There are no downloads or recommended reading links for this video

Comments
Jim Phillips on 12/4/2008
Just what I was looking for.

Dick Rosenberg on 12/14/2008
I have wanted to know how to do this in SSIS ever since I started learning SSIS. Thanks!

Satish on 12/29/2008
nice thank u

Srividya on 1/6/2009
it is a good video but must be still have explained the time graph in a detailed manner

Sridhar on 1/21/2009
DO you also have a video how to add timestamp to an .mdb file?

jag on 1/21/2009
h

vinaykotha on 1/28/2009
Its really a good video

vinaykotha on 1/28/2009
How to add a timestamp to a table

Marco Rios on 2/7/2009
qqqqqq

lesasapre on 2/9/2009
Good.Keep going..

praxy on 2/10/2009
thanks Brian Knight it was very helpfull to each ssis learner

Ed Svastits on 2/10/2009
Easy to understand. Great tip.

Marc Kuyper on 2/10/2009
concise and very instructive.

Rubens on 2/10/2009
I really appreciate the SSIS videos, especially because I am very inexperienced with it. Please keep them coming!

A1438BFC47 on 2/10/2009
I had to do this last week, but the format of the date string they wanted was very specific. Moreover I had a feeling they would change their minds. I created some variables and pass them into an SSIS script task, build the connection string, and assign it to a variable. That variable is used in an expression for the file connection string. Now they can adjust what values are passed to the variable in the SQL Agent job and I never have to touch the SSIS package when they change their minds...

Thomas Kelley on 2/10/2009
As always, thanks.

Larry on 2/10/2009
It's good that you show some of the issues that might arise with any particular solution.

Raalnan Five on 2/10/2009
First video I have watched on the site. There was no real lead in to tell me what I was watching, so I just jumped in at the first video.

Ibrahim Hafidh on 2/11/2009
Great video. I really like it when you make a mistake and then show how to correct it; as opposed to everything going smooth. I would like to see a tutorial on assigning a variable to the path. You kind of skimmed through that at the end.

Terence Tully on 2/12/2009
Awesome...as always, Brian has a knack for breaking down and explaining tasks that makes it easy and relevant to learn!

Richard on 2/13/2009
I like it! Not only the videos are awesome, but the questions after that make me think of what I've just watched and remember it easier!

Larry Blackford on 2/17/2009
Everyday real life example, excellent value.

vijay choudhri on 2/17/2009
Very good connectionstring.

Krish on 2/22/2009
Very good vedio with goood example

mahmoud on 2/26/2009
this video is very good, now ilearn how to use exprtion for connection string

This is great! A 6 minute video allows me to do what would have taken hours to correctly find on the net! Thanks jumpstartTV!!! I will post this link on twitter.

Wil Sisney on 3/16/2009
Fantastic demo. Keep it up!

Mike on 3/26/2009
good video. Appreciate your working through the errors, more 'real world' like.

Daron on 4/28/2009
Great video!, but would rather you use the variable approach to be more real-world.

Jeremy Pryor on 4/30/2009
Absolutely love the Zooming in/out, red arrows, red underlining, and the red circle beacon type flash in this presentation. Completely Awesome, it just adds to an already exceptional training session.

prashant on 5/7/2009
good one brother.

singaravelu on 5/14/2009
ss

Marten on 5/28/2009
Good video. Short and right on the spot!

SEKHAR ANIMILLA on 5/31/2009
excellent learning resourse

donald on 6/5/2009
video to small to see clearly.

Amy Darroh on 6/16/2009
THANK YOU! This, combined with assigning the file mod date/time to a variable, was exactly what I needed to do today! This was the clearest explanation I found.

Angelito Manalac on 6/17/2009
i love the this way of learning, it saves me a lot of time reading multiple materials, more power

Jerry Loyd on 6/23/2009
This solved one of the biggest problems I was facing in SSIS. It is amazing how misleading some of the dialogs are, such as for Connection Managers.

Dion on 6/30/2009
Just what i needed thanks

Super Khool on 7/8/2009
To the point and precise instructions. Good job.

Bruce Bealer on 7/9/2009
Question # 2 was worded poorly

James Moore on 7/22/2009
Cool stuff! Thanks, Brian!

Jim Berry on 8/6/2009
very good

R on 8/11/2009
Good one!

Sameer on 8/11/2009
Nice work Brian and beautifully presented.

Leigh Anne on 8/12/2009
Great video! I just wish you had zoomed in on the expression that included the timestamp with the replace function to remove colons. I really wanted to do a screen capture on that one.

Praveen on 8/31/2009
good .. was very helpful

Rajesh on 9/10/2009
Nice One!

srinivas on 9/29/2009
Excellent video

Rhys Domingo on 9/30/2009
Wasn't clear on how to use the connection string after you make the changes in this video.

Ben Cheeld on 10/1/2009
Little fuzzy on screen

Trudie Pearcy on 10/12/2009
This works great for flat file destinations, but I can't get it to worik at all on Excel file destinations.

sunil on 10/24/2009
wish i got the code

James Zhuo on 12/2/2009
Not enough context, otherwise good

Chad on 12/9/2009
I really enjoyed this video and spent quite a few days trying to find out exactly how to add a timestamp to a flat file. The only problem i'm having now is that my timestamp won't parse, I get a truncation error and i'm using the exact same code as in the video. Not matter what I try it just doesn't work.

rupesh sharma on 12/15/2009
very informative

Ashish on 12/28/2009
Great demo, thanks.

wilfredo on 1/5/2010
It would be good if we could read what you are doing. Only when you are zooming in we see it.

lotfi on 1/14/2010
thank you

sunil on 1/15/2010
voice with vedio streaming is breaking due to network or internet.

Jay Shetty on 1/20/2010
simple and effective

Matt Packer on 1/31/2010
Exactly what I was trying to solve, yet very concise. THANKS!!!!

ranu on 2/15/2010
thx..it was useful

mareeswaran on 2/17/2010
good

Velu on 2/22/2010
very nice to understand.txs a lot.

Stephen Anslow on 3/1/2010
I would love to see the final code as something I can copy-paste having watched the video... :-)

Andrei on 3/2/2010
great video guys

Eugene Ganzenko on 3/11/2010
When I use "C:\\TEST\\Archive\abc.txt"+ "_"+ (DT_WSTR, 40)(DT_DBDATE)GETDATE() it works fine. Now I want to add time like you do: "C:\\TEST\\Archive\abc.txt"+ "_"+ (DT_WSTR, 40) (DT_DBDATE) GETDATE() + (DT_WSTR, 40)(DT_DBTIME)GETDATE() and get error message “A truncation occurred during evaluation of the expression.” But it works in your video just fine! We are on SQL2008. What could be the problem? Thank you very much.

Simon on 3/15/2010
to the point, clear.

Brondor on 3/18/2010
bad sound

excellent!

bobby on 3/23/2010
Can you pls provision something so we can download and watch it full screen ? thanks, bobby

C Boos on 3/30/2010
The explanation was okay but built on a previous understanding of the DT functions and the expression concept both of which are new to me

Aniruddha on 3/31/2010
uiygjhlk

Cosmin Tornea on 4/12/2010
super

Narendra on 4/18/2010
excellent

Irene Floyd on 4/19/2010
Great video! You hard coded the file name and path, but mentioned that you could have used a variable. I tried that, but am getting an error message on the last FINDSTRING about "@" not being recognized. How do I get around that?

Ravi on 4/23/2010
some time video is not cleare. rest of all are good.

Great video, showed my just what i wanted step by step.

Jamie Portolese on 5/11/2010
Exactly what I was looking for. Love these videos

Ram on 6/9/2010
It ia very usefull

Muniabu on 6/10/2010
good

sarika on 6/15/2010
Video was great. I get following error when I try to rename file using this method, any idea why? TITLE: Package Validation Error ------------------------------ Package Validation Error ------------------------------ ADDITIONAL INFORMATION: Error at Restraints [Connection manager "DestinationConnectionExcel"]: The connection string format is not valid. It must consist of one or more components of the form X=Y, separated by semicolons. This error occurs when a connection string with zero components is set on database connection manager. Error at Restraints: The result of the expression ""\\fh1adcb\\clientdata\\DTSData\\Restraints" +(DT_WSTR, 30)(DT_DBDATE) GETDATE() + " "+REPLACE((DT_WSTR, 30)(DT_DBtime) GETDATE(), ":", "")+ ".xls"" on property "ConnectionString" cannot be written to the property. The expression was evaluated, but cannot be set on the property. (Microsoft.DataTransformationServices.VsIntegration) ------------------------------ BUTTONS: OK ------------------------------

justme on 6/17/2010
great explaination!

alban on 6/22/2010
work as it says on the tin. Thanks.

Kaladhar on 6/30/2010
Excellent

sudipta on 7/29/2010
Awesome trick !

Anil Babu on 8/3/2010
ok

Mike Nicholas on 8/18/2010
Pretty good! I've been having trouble doing some file system tasks using variables in order to manipulate some flat files, so I was hoping this tutorial would incorporate the variables based on expressions rather than just the expression alone.

Chris Freund on 10/14/2010
Great video... Need a few more closeups when typing the code (for Newbies like me)

Marat on 3/8/2011
Helped me to understand how to concatenate date and time into a file name.

Kandarp on 3/22/2011
This question was asked to me in one of the interview recently. I thought of making expressing that uses getdate(). But, it needs lot of tids and bits to make it works.Great video. Thanks

Kandarp on 3/22/2011
Please, make it available for download. I am collecting such great videos.

Kandarp on 3/22/2011
Great article.

Amit on 5/10/2011
I do it in DTS with the help of VB script, In SSIS its quite simple. Thanks for sharing knowledge Brian :)

suvankar on 7/14/2011
very nice

ranga rao on 7/14/2011
Very nice solution. I have done this but this is a more elegant solution.

Dan Feiling on 7/14/2011
how would you change the format of the date i.e. to yyyymmdd

Al on 7/14/2011
Blurry screen

Howard Rosen on 7/14/2011
It was a little hard to see on my computer

Billy Williams on 7/14/2011
Question one should say date instead of time.

Robert Gibson on 7/14/2011
I really needed to see this particular video! Thanks a lot!

randall on 7/14/2011
Love the series, though I wish the video was in higher resolution. It is hard to read the code and blurry with the window maximized.

Harvey Schwartz on 7/14/2011
Thorough presentation with a quick recap at the end.

Jim on 7/14/2011
FileNames with the date examples are everywhere on the internet, but adding the time to a file name for a process that runs multiple times per day is not easy to find. This questions was asked by a co-worker yesterday and this is very clearly shown for an example to pass along. Thanks.

37F4DA828D on 7/14/2011
you MUST be psychic - I needed this about a 1/2 hour ago...

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Aashish on 7/14/2011
the function used to strip the time is db_dbtime and not the 2nd option.

Keith Cooper on 7/14/2011
keep these type of short videos coming. the speaker is easy to understand and the content is much needed.

John Barone on 7/15/2011
Thank you! I knew about expressions, but I learned another way of getting the date in there. I have always done Year + Month + Day before. I'll try this way too.

1328BAD5E1 on 7/15/2011
A bit too fast. --Would like to be able to copy the conclusiong.

Edgar Machado on 7/16/2011
Speak slower and more clear. Slow down in the presentation.

jayamanjunath on 7/17/2011
when i try with this code "c:\\dummy\\personcontact"+ (DT_WSTR,30) (DT_dbDATE) GETDATE() + (DT_WSTR,100) (DT_DBTIME) GETDATE()+".csv" i am getting an error a truncate occured during evaluation of the expression where has if i not concateing the + (DT_WSTR,100) (DT_DBTIME) GETDATE() the code executes pls help in this regards

NehalRana on 8/3/2011
we should use different formmatting functions to convert datetime into string.

903F0E5D15 on 8/4/2011
Thank you for the tip about DT_DBDATE! I've been using a very lengthy bit of code to extract the year, month, and day, and place zeroes in front of single-digit months and days... doh!

Cynthia Weers on 8/15/2011
ANDY LEONARD is as life-saver... One learns so much from so many different sources, it's tough to remember where to go look when you want to recall something... This website is amazing!

Mohsin on 8/18/2011
pronunciation is faster

pankaj on 9/16/2011
Best way to kick off SSIS.Thanks

Maurice Ivory on 11/28/2011
I like this one, I think I will go over it again.

mohannareshv on 1/19/2012
It is good for learners. Thanks

mohannareshv on 1/19/2012
It is good for learners. Thanks

Smart Sol on 2/8/2012
Awesome

Omid Taheri on 2/28/2012
Good video. First time on your site. Will come back soon.

dhruvangini on 3/3/2012
Could not see all data flow task's objects

Santhana on 5/28/2012
simply superb

radha on 10/3/2012
thanks

lekkie on 10/25/2012
Excellent guide

kumar s on 5/11/2013
gud test,i got confidence



Must Be Logged In
 

How Do I Become a Video Author? |  Newsletter History

Copyright © Fourdeuce, Inc., 2005-2009. All Rights Reserved | Privacy Policy | Terms & Conditions