Re: Q: ISQL Utility and DOS commands
From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 08/18/04
- Next message: Adam Machanic: "Re: SQL SERVER capacity"
- Previous message: Larry Menzin: "Using CREATE DATABASE With String Variables"
- In reply to: Richard J: "Re: Q: ISQL Utility and DOS commands"
- Messages sorted by: [ date ] [ thread ]
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) > >
- Next message: Adam Machanic: "Re: SQL SERVER capacity"
- Previous message: Larry Menzin: "Using CREATE DATABASE With String Variables"
- In reply to: Richard J: "Re: Q: ISQL Utility and DOS commands"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|