Differences when using osql vs sqlcmd

I am running a stored procedure which produces a report via a batch process.  In the past I have used the osql command.  After implementing SQL Server 2005, I was asked to use sqlcmd instead.

OLD Statement
osql -E  -S EMISTEST -d DCRVW000 -Q usp_act_MEM_Load_Balances_custval -o \\AVST404\EMIS_Batch\Finance\Actuals_CustVal\Act_Mem_Val\X18Y_FBP_Act_Mem_Val_10172007_132822_Report_1.txt  

NEW Statement
sqlcmd -E  -S EMISTEST -d DCRVW000 -Q usp_act_MEM_Load_Balances_custval -o \\AVST404\EMIS_Batch\Finance\Actuals_CustVal\Act_Mem_Val\X18Y_FBP_Act_Mem_Val_10172007_132822_Report_1.txt

The old method creates a report text file correctly but the new method does not.  Also, the batch processing just seems to stop.  It does not process any routines that are called after the statement to process the stored procedure.  

I know that I can just use the old method for now but I am being asked to explain why the new method does not work and I cannot determine the reason.
jpelldevAsked:
Who is Participating?
 
authentifyCommented:
My first guess is permissions. Make sure that whomever is operating that batch file has permission to create a file in the target folder. Many of the permissions we used to take for granted in older versions are all turned off in the new version.
Try the proc in a query window or a DOS box by hand so you can see what's happening.
OSQL and SQLCMD are supposed to be functionaly equivalent so if it worked before, it ought to work now.
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.

All Courses

From novice to tech pro — start learning today.