0

I am using below command in bat file to get some information from the list of sql instance,i am using -E to login as windows authentication when i manually triggering the bat file.

Could anyone help how to configure it on SQLJOB.i am sure that - E will not work on SQLjob ..

Thanks in advance!!

FOR /F %%G IN (E:\serverlist\serverlist.txt) DO (echo %%G sqlcmd -S %%G -iE:\serverlist\some.sql -h-1 -W -w1000 -s "," -m1 -E >>E:\output\result.txt )

1
  • i have tried runas command but its not working Commented May 25, 2016 at 12:57

2 Answers 2

1

using proxy account helped to resolve the issue.just add the sqlcmd command under a job step with Run as 'Proxy account'

Sign up to request clarification or add additional context in comments.

Comments

1

try this.

sqlcmd -S .\sqlexpress -E -i "c:\test.sql" -o "c:\output.txt" (This command would execute a SQL script on a local SQLExpress server using Windows Authentication)

sqlcmd -S mysql -U sqluser -P sqlpassword -i "c:\test.sql" -o "c:\output.txt" (This command would execute a SQL script on a SQL server using SQL authentication)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.