You are here: Re: osql batch processing without -i « MsSQL Server « IT news, forums, messages
Re: osql batch processing without -i

Posted by <dphillip79 on 01/20/06 04:17

"Hugo Kornelis" <hugo@perFact.REMOVETHIS.info> wrote in message
news:raiqs1pfephh7faud9sesnjot56c7tdng9@4ax.com...
> On Mon, 16 Jan 2006 18:44:19 -0600, <dphillip79@comcast.net> wrote:
>
> (snip)
> > In UNIX, I can simply execute the following from either the command
line
> >or in
> >a script.
> >
> >isql -S<DATASERVER> -U<USER> <<-EOF
> >
> >sp_who
> >go
> >select * from .....
> >go
> >EOF --EOF is the isql session terminator exits me back to the command
line.
> >
> > This behavior does not appear to work with OSQL.
>
> Hi,
>
> It's not OSQL, it's Windows/DOS that is causing the difference. In UNIX,
> utilities take their input from STDIN, which is either the next line in
> the script (if run from a script) or the next line entered on the
> console (if run from a console).
>
> The same thing happens if you create a script (testme.bat) with the
> following content:
>
> copy con test.txt
> This won't work
>
> Execute it. The copy con command is started and the console will wait
> for your input. Type one or more lines, then type Ctrl-Z (the EOF
> marker). You'll next see an error because "Thins won't work" is not a
> valid DOS command.
>
> An equivalent script in Unix would enter "This won't work" in the file
> test.txt.
>
> > Any help you could offer would be appreciated.
>
> I think that you'll have to settle for either a bunch of commonly used
> SQL script files, or for dynamically building the SQL script using a
> bunch of redirected echo statements.
>

Thanks for the Info Hugo. I was afraid of that. I'm used being able to
do whatever I want in UNIX, so DOS seems to be a bit of a step back for me.
I did just download a version of sed for DOS, which I'm really excited
about. :) I also have a VB .net class next week, so I'm hoping to pick up
some tricks in there. Thanks again.

Darren

> --
> Hugo Kornelis, SQL Server MVP

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация