Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

MS SQL Restore to a different Server with Diffs and different File Names

Hi Experts,

I receive diff file on a daily bases and the challenge I have is the file names are different each time I get a diff backup but only the date.

I'm attemping to the get the following date format for my script 16042014 - ddmmyyyy but I seem to be getting 2014-04-16.
 
set @datestring = convert(NVARCHAR(112),getDate(),23)
0
johnojohno
Asked:
johnojohno
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
23 isn't a valid date format. If you want ddmmyy try:
select replace(convert(varchar(10), getdate(), 103), '/', '')

Open in new window

0
 
johnojohnoAuthor Commented:
Thanks bud, this is the working solution. Happy Days

set @datestring = replace(convert(varchar(10), getdate(), 103), '/', '')
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now