Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 SQL formatting issue

Author  Topic 

SQL_SSIS_Dev
Starting Member

10 Posts

Posted - 2014-09-29 : 17:50:49
This is the file name:

aSNAP_Data_20140929_P-2014-09-29_07.01.34.dat

I need to give this name to the SSIS package in such way that it automatically pucks up the current date's file and processes it.

I started it in the below fashion:

"\aSNAP_Data_"+cast(year(getdate()) as nvarchar)+......

Could anyone please finish the above? I am bit confused with the date functions. example - I am not sure how to get the date value as '09' instead of '9'.

Any help is highly appreciated. Thank you.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-09-29 : 19:39:35
convert(varchar(10),getdate(),101)

Or check out the other styles available for the convert function.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -