Page 1 of 1

Domina error when trying to execute BAT file on SQL Server

Posted: 25 Mar 2009 11:15
by bex
I have created a BAT file to run a procedure that, in turn, creates another BAT file based on the tables within the database.

This was working locally with no issues.

I have now logged onto the database server, and have tried to execute the first BAT file, but obtain the following error:

Msg 3623, Level 16, State 1, Server S3-TEST-DB, Procedure CreateBATScriptForStoreExtrapolation, Line 141
A domain error occurred.

I have tried using both a trusted connection and also a SQL Server sa account.

The file is actually created (as it contains the error message), but it appears I cannot execute the procedure from the BAT file?

Is this correct and if so, what can I do to rectify the situation?

Thanks

Posted: 25 Mar 2009 11:58
by RElliott63
This seems to me like you're trying to run a DOS script from a MS SQL Server job.

If that's the case, make sure you're calling the DOS script like the following:


Code: Select all

Exec master..xp_cmdshell '\\Server\Folder\ScriptName.bat'


I think that might help you get what you're looking for.

PS: You might want to do a Set NoCount ON then OFF before and after those commands unless you're looking for the feedback from those jobs.

Posted: 25 Mar 2009 12:30
by bex
Thanks for your reply!

That has certainly helped :)