Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I need to import textfile from web everyday. File downloaded from web always has the same file name. I want it to be renamed by date. Anybody knows how to code that?
tkizer
Almighty SQL Goddess
38200 Posts
Posted - 2003-11-04 : 15:06:52
You could use the RENAME DOS command. Something like this:EXEC master.dbo.xp_cmdshell 'RENAME C:\temp\SomeFile.txt C:\temp\SomeFile' + CONVERT(VARCHAR(50), MONTH()) + CONVERT(VARCHAR(50), DAY()) + CONVERT(VARCHAR(50), YEAR()) + '.txt'Tara