October 23, 2008 at 2:44 pm
I tried this but still give me the same problem. everything run ok it juts leave the cmd open
EXECUTE xp_cmdshell '"D:\Folder\Task.exe"
October 23, 2008 at 3:09 pm
How do you know that the process actually completed, if it never returns?
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
October 23, 2008 at 3:22 pm
it gives result to our SQL database.
October 23, 2008 at 3:26 pm
That does not mean that it is completed. It could be still hanging around trying to read command input from somewhere or something (that will never come, obviously). It all depends on how your "Task.exe" command is written.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
October 23, 2008 at 3:29 pm
Actually I suspect that... hmmm is there anyway I can kill the cmd.exe in SQL.
Thanks!
October 23, 2008 at 3:42 pm
You might try this:
EXECUTE xp_cmdshell '"D:\Folder\Task.exe"
'
If that does not work, then try this:
Declare @dos varchar(4000)
Select @dos = '"D:\Folder\Task.exe"
' + Char(3) + '
'
EXECUTE xp_cmdshell @dos
Who knows, it might work....
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
October 23, 2008 at 8:33 pm
CHAR(3)? Do you mean CHAR(13)?
--Jeff Moden
Change is inevitable... Change for the better is not.
October 23, 2008 at 8:34 pm
I'd be much more interesting in knowing what it is that "Task.exe" does and why you think it can't be done in T-SQL, whatever it is.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 23, 2008 at 8:39 pm
Jeff Moden (10/23/2008)
CHAR(3)? Do you mean CHAR(13)?
Nah, I've already got my Char(13)+Char(10)'s in the embedded line-breaks. Char(3) is Control-C.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
October 23, 2008 at 9:16 pm
What does Ctrl-C do for this here?
--Jeff Moden
Change is inevitable... Change for the better is not.
October 23, 2008 at 9:59 pm
If the program is waiting for input from the command pipe that the SQL process used to issue the command, then a Control-C may cause it to exit. Now this works interactively for almost all DOS command-line programs that prompt for follow-on input or commands.
As to whether that would work for a piped-in command context like this, remember what I said:
rbarryyoung (10/23/2008)
You might try this:...
Who knows, it might work....
Only way to know is to try it.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
October 23, 2008 at 10:02 pm
Dang... I forgot all about that. Thanks for the reminder.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 24, 2008 at 7:54 am
Thanks guys, I monitor the task.exe and it open new cmd.exe that never terminated. now what I need to know is how to kill the cmd.exe using vb code.
October 24, 2008 at 8:23 am
anvieph (10/24/2008)
Thanks guys, I monitor the task.exe and it open new cmd.exe that never terminated. now what I need to know is how to kill the cmd.exe using vb code.
Did you try both of the things that I posted above?
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
October 24, 2008 at 8:30 am
yes I did...
Viewing 15 posts - 16 through 30 (of 52 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy