From: geebee on
hi,

I have the following in a batch file, intended to run a sql file.. it opens
up the SQL file, but does not actually execute it. Am I missing something?
I have looked at and tried tons of example...


C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe -i
c:\zigzag.sql -o c:\tiki.log


pause


Thanks in advance,
geebee

From: Gene Wirchenko on
On Tue, 27 Jul 2010 11:38:21 -0700, geebee
<geraldjr30(a)hotmail.com(noSPAMs)> wrote:

>I have the following in a batch file, intended to run a sql file.. it opens
>up the SQL file, but does not actually execute it. Am I missing something?
>I have looked at and tried tons of example...
>
>C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe -i
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I do not know if this is it, but this filename contains spaces.
It should be quoted.

>c:\zigzag.sql -o c:\tiki.log
>
>
>pause

Sincerely,

Gene Wirchenko
From: geebee on
hi,

there were no spaces originally. im just not sure what i could be doing
wrong.

thanks in advance,
geebee


"Gene Wirchenko" wrote:

> On Tue, 27 Jul 2010 11:38:21 -0700, geebee
> <geraldjr30(a)hotmail.com(noSPAMs)> wrote:
>
> >I have the following in a batch file, intended to run a sql file.. it opens
> >up the SQL file, but does not actually execute it. Am I missing something?
> >I have looked at and tried tons of example...
> >
> >C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe -i
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> I do not know if this is it, but this filename contains spaces.
> It should be quoted.
>
> >c:\zigzag.sql -o c:\tiki.log
> >
> >
> >pause
>
> Sincerely,
>
> Gene Wirchenko
> .
>
From: Gene Wirchenko on
[reordered to chronological]

On Wed, 28 Jul 2010 09:10:33 -0700, geebee
<geraldjr30(a)hotmail.com(noSPAMs)> wrote:

>"Gene Wirchenko" wrote:
>
>> On Tue, 27 Jul 2010 11:38:21 -0700, geebee
>> <geraldjr30(a)hotmail.com(noSPAMs)> wrote:
>>
>> >I have the following in a batch file, intended to run a sql file.. it opens
>> >up the SQL file, but does not actually execute it. Am I missing something?
>> >I have looked at and tried tons of example...
>> >
>> >C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe -i
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> I do not know if this is it, but this filename contains spaces.
>> It should be quoted.
>>
>> >c:\zigzag.sql -o c:\tiki.log
>> >
>> >
>> >pause

>there were no spaces originally. im just not sure what i could be doing
>wrong.

Take a look at the caretted filename. I very much doubt that you
have a directory name
C:\ProgramFiles
rather than
C:\Program Files
on your system.

If there are any spaces in the path or the filename, quote the
whole thing. Quoting will not hurt if there are no spaces.

Sincerely,

Gene Wirchenko
From: geebee on
Hi,
I now have:
"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe -i
c:\zigzag.sql -o c:\tiki.log"

pause

It opens up the query, but does not execute it, and the batch window has all
of the following in it:
C:\>"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe -i
' "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe -i ' is
not recognized as an internal or external command,
operable program or batch file.

c:\zigzag.sql -o c:\tiki.log"
c:\>pause


not sure what i need to change.


thanks in advance,
geebee

"Gene Wirchenko" wrote:

> [reordered to chronological]
>
> On Wed, 28 Jul 2010 09:10:33 -0700, geebee
> <geraldjr30(a)hotmail.com(noSPAMs)> wrote:
>
> >"Gene Wirchenko" wrote:
> >
> >> On Tue, 27 Jul 2010 11:38:21 -0700, geebee
> >> <geraldjr30(a)hotmail.com(noSPAMs)> wrote:
> >>
> >> >I have the following in a batch file, intended to run a sql file.. it opens
> >> >up the SQL file, but does not actually execute it. Am I missing something?
> >> >I have looked at and tried tons of example...
> >> >
> >> >C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe -i
> >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >> I do not know if this is it, but this filename contains spaces.
> >> It should be quoted.
> >>
> >> >c:\zigzag.sql -o c:\tiki.log
> >> >
> >> >
> >> >pause
>
> >there were no spaces originally. im just not sure what i could be doing
> >wrong.
>
> Take a look at the caretted filename. I very much doubt that you
> have a directory name
> C:\ProgramFiles
> rather than
> C:\Program Files
> on your system.
>
> If there are any spaces in the path or the filename, quote the
> whole thing. Quoting will not hurt if there are no spaces.
>
> Sincerely,
>
> Gene Wirchenko
> .
>