October 12, 2010 at 11:14 pm
Hi,
I have to execute an SP from .bat file. What I have done is, I have created a .bat file with the following entry:
%OpMode% %msISQL% Some_File.sql
The "Some_File.sql" file contains the following execute statement:
execute [dbo].[Stored_Proc_Name] 1,0,0,''
The connection parameters for the database are in another .bat file.
When I execute the .bat file, am getting the following error:
Msg 170, Level 15, State 1, Server SERVER_NAME, Line 1
Line 1: Incorrect syntax near 'ÿ'.
Any help is appreciated..
Thanks,
Nivetha
October 13, 2010 at 7:06 am
I would suspect that the line you're executing isn't correct.
Try putting an "echo %OpMode% %msISQL% Some_File.sql" to ensure that it's being called properly (you may need a "pause" in there also).
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 14, 2010 at 12:06 am
Hi,
Am getting the following entry in my log file when i put echo before
%OpMode% %msISQL% Some_File.sql:
CALL C:\sql\core\MS_ISQL_Driver.bat Some_File.sql
executing MS_ISQL_Driver.bat with input file Some_File.sql
---- START ERROR HANDLING -----
BATCH TERMINATED by unexpected error "in SQL Script Some_File.sql". Skipping remaining batch.
I think there is problem with the Some_File.sql, means, my way of executing the stored procedure might be wrong..
I have entry as:
execute [dbo].[Stored_Procedure_Name] 1,0,0,''
Is this right?
December 1, 2011 at 8:43 am
I have the same error message. I am running a batch file that calls a SQL file that runs a pretty simple update script. When I run the script manually, it runs fine. The same syntax that applies to the call to this script is used to call multiple other scripts on a nightly basis, and the others all work. Here is the error message (which I know is not very helpful by itself):
Incorrect syntax near 'ÿ'.
Like I said, the same batch file contains calls to 6 SQL scripts, all with the same credentials and syntax.
December 2, 2011 at 3:21 pm
Are you actually getting the lowercase y with the two little dots over it?
If so, your sql file is saved in Unicode, not standard ASCII. Open the sql file in SSMS, click file ~ save as, and then on the Save button click the little down-arrow at the right - select "save with encoding" and then select 1252 and then you can save it in ASCII.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply