2

Goodafternoon,

i am looking for a variable for the date and time. I have several backups in one directory and want to restore the latest to a another server. Is there a variable i can use in my script?

test_db_201508**162300**.BAK

the script

restore database [test]
from disk = N'R:\testserver\test_db_201508**162300.BAK**'
with file = 1
    ,move N'test' to N'E:\Databases\test.mdf'
    ,move N'test_log' to N'F:\Logfiles\test_1.ldf'
    ,NOUNLOAD
    ,REPLACE
    ,STATS = 10
go
  • 2
    Look at my answer here. Let me know if you need any more help. – Kin Shah Aug 18 '15 at 20:32
  • this does not work ): – ingrid Aug 19 '15 at 19:10
  • what does not work ? Did you try ? what error are you getting ? – Kin Shah Aug 19 '15 at 19:24
  • this is what i get for error – ingrid Aug 19 '15 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.