Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 xp_cmdshell against cmdexec in job

Author  Topic 

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-10-06 : 06:48:43
i am hoping someone has encountered this before:

i'm trying to run an exe mail application from sql. here's my problem:
if i execute the file from a job and use cmdexec as type of job step, it works fine,
but if i use tsql and run it from a stored proc, it doesn't fail but won't send the mail.

here's the sample code:

from cmdexec job: c:\program files\sendmail.exe "parameter"

from tsql job : exec spSendMail
create proc spSendMail
as
exec master..xp_cmdshell 'c:\program files\sendmail.exe "parameter"'
go

thanks in advance...

kselvia
Aged Yak Warrior

526 Posts

Posted - 2004-10-06 : 10:48:15
Try exec master..xp_cmdshell '"c:\program files\sendmail.exe" "parameter"'

Or exec master..xp_cmdshell 'c:\progra~1\sendmail.exe "parameter"'


--Ken
I want to die in my sleep like my grandfather, not screaming in terror like his passengers.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-10-07 : 02:22:14
quote:
Originally posted by kselvia


exec master..xp_cmdshell 'c:\progra~1\sendmail.exe "parameter"'

--Ken



thanks ken, this worked.
Go to Top of Page
   

- Advertisement -