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
 Import/Export (DTS) and Replication (2000)
 xp_cmdshell 'DTSrun...

Author  Topic 

Dennis Falls
Starting Member

41 Posts

Posted - 2005-08-23 : 16:54:52
I am trying to use xp_cmdshell as follows

CREATE TRIGGER trg_rptAdminTest
ON tblTest
AFTER INSERT
AS
Exec master.dbo.xp_cmdshell 'dtsrun /S MyServer /N TestNewUser /E'
declare @rc int
Exec @rc = master.dbo.xp_smtp_sendmail
@FROM = 'Me@MyHost.com',
@TO = 'You@YourHost.com',
@subject = 'New User Request',
@attachments = 'E:\NewUsers\NewUserTest.txt',
@message = 'There is a request for a new user account. See attached file for details.',
@server = 'smtpserver.com'
select RC = @rc
GO

I can run it without the trigger in query analyzer and I can run it from the trigger if I comment out Exec master.dbo.xp_cmdshell 'dtsrun /S MyServer /N TestNewUser /E'

But if I leave the statement intact and try to do an insert into the table containing the trigger, everything hangs to the point I have to stop sql server service to get it to break loose.

I think I have all the permissions set. What else should I be looking for?

   

- Advertisement -