all groups > sql server new users > april 2006 >
You're in the

sql server new users

group:

Operating System (CmdExec), SQLCMD


Operating System (CmdExec), SQLCMD Donald
4/28/2006 4:25:42 PM
sql server new users:
Hello everyone,

I want to know if this is a SQL Server Management Studio Bug or something
that I am missing. I want to setup a job to call SQLCMD to execute a sql
script:

sqlcmd -S MySQLServer -d tempdb -i c:\mySQLCmdTest.sql -o
c:\mySQLCmdTest.txt

This command works fine in a CMD prompt. However when I set it up as SQL
Agent Job, it keeps giving me following error:

Input string was not in a correct format. (mscorlib)

No matter what I do, I cannot get it work. There's a tip in the job dialog,
but that wouldn't help.

Tip: Enclose command names that contain spaces in quotation marks. For
example: "command name" <arguments>.

Thank you in advance for any insight!

Donald

Re: Operating System (CmdExec), SQLCMD Jens
4/30/2006 1:59:06 AM
Hi,

I created the same same like you did with your syntax. You have two
spaces between the -o and the file which made my job to fail. But after
fixing that the job worked just fine. You could additionally leave out
the blanks between the switch and the switch value. like
-oC.\somefile.txt

HTH, jens Suessmeyer.

---
http://www.sqlserver2005.de
---
Re: Operating System (CmdExec), SQLCMD Donald
5/2/2006 5:02:23 PM
Thanks Jens. I think you are missing my point.

The SQLCMD works fine in a CMD prompt. But it gives error when I try to
define it in a Management Studio Job.

Even I specify DIR C:\*.* in the command in the Management Studio's job
panel. It still give me error.

So I want to see if anyone tried this.

Donald


[quoted text, click to view]

Re: Operating System (CmdExec), SQLCMD Donald
5/2/2006 5:12:59 PM
I have 1 of my fomer colleagues tried my scenario on
Microsoft SQL Server Management Studio 9.00.1399.00

.. He has not problem. So I think it this is a bug on a newer release of :
Microsoft SQL Server Management Studio 9.00.2047.00




[quoted text, click to view]

Re: Operating System (CmdExec), SQLCMD Jens
5/3/2006 3:09:12 AM
I am also running 2047 (SP1) and have no problems.
Re: Operating System (CmdExec), SQLCMD Donald
5/3/2006 11:28:12 PM
That's very strange. I cannot get it work. I even make the simple CmdExec
job to do just DIR C:\*.*. I keep getting that error.

Input string was not in a correct format. (mscorlib)




[quoted text, click to view]

AddThis Social Bookmark Button