How can we help you today? How can we help you today?
aarons44
Is this true encryption of the entire file? I'm just a little skeptical, since Microsoft can't make encryption and compression work together in SQL Server 2008. / comments
Is this true encryption of the entire file? I'm just a little skeptical, since Microsoft can't make encryption and compression work together in SQL Server 2008.
0 votes
Ok, you got me pointed in the right direction and I got it figured out. It was: query10 = "-SQL ""RESTORE DATABASE " & myString6 & " FROM DISK = 'G:\myFiles\CompressedBackups" & myFile6 & "' WITH MOVE '" & myString6 & "' TO 'G:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data" & myString6 & ".mdf', MOVE '" & myString6 & "_LOG' TO 'G:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data" & myString6 & ".ldf', MAILTO='myemail@mydomain.com', THREADPRIORITY=6 "" -I sql -U user -P password " The comma before the MAILTO was needed to make it a continuation of the previous WITH statement. Thanks for your help. It was really confusing getting the single quotes, double quotes, two sets of double quotes, etc. all figured out to make this work. Jason Cook wrote: Hi, The generated command will not function correctly because of confusion between the various tags. Any part of the SQL Backup command needs to go inside the -SQL "..." tag, and the -I, -U and -P tags come afterwards. So in your example, this should be: query10 = "-SQL ""RESTORE DATABASE " & myString6 & " FROM DISK = 'G:\myFiles\CompressedBackups" & myFile6 & "' WITH MOVE '" & myString6 & "' TO 'G:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data" & myString6 & ".mdf', MOVE '" & myString6 & "_LOG' TO 'G:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data" & myString6 & ".ldf' WITH MAILTO='myemail@mydomain.com', THREADPRIORITY=6"" -I sql -U user -P password " Hope that helps, Jason / comments
Ok, you got me pointed in the right direction and I got it figured out. It was: query10 = "-SQL ""RESTORE DATABASE " & myString6 & " FROM DISK = 'G:\myFiles\CompressedBackups" & myFile6 & "' WITH M...
0 votes
thank you for the suggestions and links. My script is definetly not VB.Net. I'm behind in my learning. But if I get into a lot more scripting, I would like to get up to date with the new options that are available with the newer scripting languages. Jason Cook wrote: Indeed, my mistake... didn't spot that you had two "WITH" statements as well. Of course should only have a maximum of one. Not sure what version of VB you are using, but if you are using .NET, you could use the String.Format function to try and make the code easier to understand (if you have to do this again in the future): For example, your code would become something like: query10 = String.Format(@ -SQL "RESTORE DATABASE {0} FROM DISK = 'G:\myFiles\CompressedBackups\{1}' WITH MOVE '{0}' TO 'G:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\{0}.mdf', MOVE '{0}_LOG' TO 'G:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\{0}.ldf', MAILTO='myemail@mydomain.com', THREADPRIORITY=6 "" -I sql -U user -P password",myString6,myFile6); Granted it's still not ideal, but it's eliminated a significant number of the double quotes... so seems slightly less complicated. The following link may be useful (mentions C#, but should be the same in VB.net): http://blog.stevex.net/index.php/string ... in-csharp/ Hope that helps, Jason / comments
thank you for the suggestions and links. My script is definetly not VB.Net. I'm behind in my learning. But if I get into a lot more scripting, I would like to get up to date with the new options th...
0 votes