SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Current directory when restore (osql)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Array
Starting Member

2 Posts

Posted - 06/24/2006 :  10:37:07  Show Profile  Reply with Quote
When I do RESTORE FILELISTONLY FROM DISK = 'db.bak' I don't want to specify the path to the .bak file. Is there any way to do this? Something like '%CD%\db.bak'?! If I for example want to put MSDE, .bak and a script file (cmd) on a CD-r I want to install (and restore) the database from the current directory.

Regards
Array

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 06/24/2006 :  22:09:25  Show Profile  Reply with Quote
When you run a SQL RESTORE command, the command is executed in the context of the database service, not the user executing the OSQL command.

You will have to specify ths path of the backup file so that the database engine can find the file.






CODO ERGO SUM
Go to Top of Page

Array
Starting Member

2 Posts

Posted - 06/25/2006 :  06:46:31  Show Profile  Reply with Quote
Thank you for the answer. I worked around the problem by copy the .bak file in the cmd script first thing before starting the osql script. Then I got the current directory and then I know exactly were the file is :-)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000