Domina error when trying to execute BAT file on SQL Server

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
bex
Posts: 11
Joined: 24 Mar 2009 05:41

Domina error when trying to execute BAT file on SQL Server

#1 Post by bex » 25 Mar 2009 11:15

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

RElliott63
Expert
Posts: 80
Joined: 04 Feb 2009 10:03

#2 Post by RElliott63 » 25 Mar 2009 11:58

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.
Last edited by RElliott63 on 25 Mar 2009 21:07, edited 1 time in total.

bex
Posts: 11
Joined: 24 Mar 2009 05:41

#3 Post by bex » 25 Mar 2009 12:30

Thanks for your reply!

That has certainly helped :)

Post Reply