Re: Q: ISQL Utility and DOS commands

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 08/18/04


Date: Wed, 18 Aug 2004 16:23:19 +0200

xp_cmdshell just echoes back whatever output your command-line program returned. (Except for that NULL line
that for some reason was introduced in SQL2K.)
Check out the second parameter for xp_cmdshell: no_output

-- 
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Richard J" <RichardJ@discussions.microsoft.com> wrote in message
news:F002A813-DAAF-443A-94F0-12323BAAA0A8@microsoft.com...
> Thank both of you for the tips.
>
> I executed the xp_cmdshell and that does seem to do the trick.  However, I
> am getting some very strange output.
>
> I will get the word 'output' followed by four or five blank lines.  Then
> four lines of dashes will appear, followed then by the first message line.
>
> Again, there will be four or five blank lines, the word NULL, and then four
> or five more blank lines and then the word 'output'.  Then it repeats itself.
>
> Any ideas on what is causing this?  And more importantly how to get rid of
> this?  It does make the xp_cmdshell proc rather unusable.
>
> Thanks.
> Richard
>
> "Hugo Kornelis" wrote:
>
> > Hi Richard,
> >
> > The !! command is interpreted by the isql utility itself and never sent to
> > the server. Execution is unconditional. The server will receive the RETURN
> > line directly after the BEGIN line. Since there is no GO in between, this
> > is all part of one batch, so I expect the !! commands to be executed even
> > before SQL Server starts counting rows in Table1 and Table1_TMP.
> >
> > Though you didn't ask, you're probably interested in an alternative for !!
> > that will allow conditional execution. I think you'll have to use
> > xp_cmdshell for this. Note that xp_cmdshell will be executed on the
> > server, in the security context of the SQL Server user account, whereas
> > the !! commands are executed at the machine where isql is started, in the
> > security context of the user running isql. Make sure that you're aware of
> > the potential security loopholes of xp_cmdshell.
> >
> > Best, Hugo
> > -- 
> >
> > (Remove _NO_ and _SPAM_ to get my e-mail address)
> >


Relevant Pages

  • Re: Q: ISQL Utility and DOS commands
    ... command is interpreted by the isql utility itself and never sent to ... Execution is unconditional. ... The server will receive the RETURN ... > server, in the security context of the SQL Server user account, whereas ...
    (microsoft.public.sqlserver.programming)
  • RE: RPc server is unavailable since SP1
    ... After these commands run successfully, ... RPc server is unavailable since SP1 ... >> when the member server update certificate you get the error message RPC ... >> interface security settings before the installation of SP1 will be lost. ...
    (microsoft.public.windows.server.sbs)
  • Re: AS2005 x64 vs x86 performance
    ... When you run Profiler against the server do you see any other activity? ... Each execution made one execution unit 100%. ... As soon as the XMLA was executed the queries get answered. ... The disk sys on the xeon srv is a FC SAN where I have an array of 4 FC ...
    (microsoft.public.sqlserver.olap)
  • Re: Replies to e-mails not received
    ... 07:17:14 Successfully initialized the resource manager ... Retrieving Blob ... server ready.") ...
    (microsoft.public.outlook)
  • [NT] NetWin DMail Authentication Bypass (dlist.exe) and Format String (dsmtp.exe)
    ... either be used as a small personal mail server or as a 10 Million user ISP ... password hash) when sending the administrative commands. ... the DList server using a numeric hash of the administrative password. ...
    (Securiteam)