March 11, 2014 at 9:24 am
I think, That's where you are having issues with. Type it manually and let me know how it goes...
syntax:
sqlcmd -S .\SQLEXPRESS -E -Q "EXEC master..sp_BackupDatabases @backupLocation='C:\SQLBackups\', @backupType='F'" -o "C:\SQLBackups\Backupjob_Log.txt"
Also, double check your Instance Name. Looks like you are using "EXPRESS" instead of "SQLEXPRESS" in your batch file.
March 11, 2014 at 1:17 pm
sreekanth bandarla (3/11/2014)
I think, That's where you are having issues with. Type it manually and let me know how it goes...syntax:
sqlcmd -S .\SQLEXPRESS -E -Q "EXEC master..sp_BackupDatabases @backupLocation='C:\SQLBackups\', @backupType='F'" -o "C:\SQLBackups\Backupjob_Log.txt"
Also, double check your Instance Name. Looks like you are using "EXPRESS" instead of "SQLEXPRESS" in your batch file.
I've made a change to the batch file, but it appears to not have made a difference. Do I have to remove the job from the Task Scheduler and re-enter it, in order for it to see the change? (I ask this because I've seen that sort of behavior before; especially with Crystal Reports. Crystal would tend to read the whole SQL query, even if it's a stored procedure, and then store that into itself, so if you made any change to the SP, Crystal never saw it.)
Kindest Regards, Rod Connect with me on LinkedIn.
March 11, 2014 at 1:32 pm
Rod at work (3/11/2014)
sreekanth bandarla (3/11/2014)
I think, That's where you are having issues with. Type it manually and let me know how it goes...syntax:
sqlcmd -S .\SQLEXPRESS -E -Q "EXEC master..sp_BackupDatabases @backupLocation='C:\SQLBackups\', @backupType='F'" -o "C:\SQLBackups\Backupjob_Log.txt"
Also, double check your Instance Name. Looks like you are using "EXPRESS" instead of "SQLEXPRESS" in your batch file.
I've made a change to the batch file, but it appears to not have made a difference. Do I have to remove the job from the Task Scheduler and re-enter it, in order for it to see the change? (I ask this because I've seen that sort of behavior before; especially with Crystal Reports. Crystal would tend to read the whole SQL query, even if it's a stored procedure, and then store that into itself, so if you made any change to the SP, Crystal never saw it.)
Okay, Let's forget about scheduling here for a while....Have you tried running the batch file from command prompt manually and see the results file? May be....you can also try running the batch file something like yourbatchfile.cmd > output.txt and verify the output.txt file.
March 12, 2014 at 7:40 am
When I run the batch file and redirect it's output, the first thing I see is this:
Sqlcmd: 'GÇôE': Unexpected argument. Enter '-?' for help.
The contents of the output.txt file are as follows:
C:\Users\rfalanga\Documents\SQL Server Management Studio\Backup Files>sqlcmd -U Superacct -P xxxx -S .\EXPRESS –E -Q "EXEC master..sp_BackupDatabases @backupLocation='C:\SQLBackups\', @backupType='F'"
Kindest Regards, Rod Connect with me on LinkedIn.
March 12, 2014 at 7:57 am
Rod at work (3/12/2014)
When I run the batch file and redirect it's output, the first thing I see is this:Sqlcmd: 'GÇôE': Unexpected argument. Enter '-?' for help.
The contents of the output.txt file are as follows:
C:\Users\rfalanga\Documents\SQL Server Management Studio\Backup Files>sqlcmd -U Superacct -P xxxx -S .\EXPRESS –E -Q "EXEC master..sp_BackupDatabases @backupLocation='C:\SQLBackups\', @backupType='F'"
There you go....That's what am saying(Sqlcmd: 'GÇôE': Unexpected argument). Type everything from scratch in a new txt file and run the batch file(This should eliminate unexpected argument issue). Also, remove -E switch from your syntax.
Viewing 6 posts - 16 through 20 (of 20 total)
You must be logged in to reply to this topic. Login to reply