CREATE TRIGGER TRG_MakeDirs
ON quote
FOR INSERT
AS

DECLARE @quotenumber varchar (10)
DECLARE @command varchar (30)
DECLARE @command2 varchar (30)
DECLARE @scope varchar (10)

SET @quotenumber = (SELECT quote_number FROM Inserted)
SET @scope = (SELECT scope FROM Inserted)
SET @command = ('c:\newdirs2.bat ' + @quotenumber)
SET @command2 = ('c:\copyfile.bat ' + @quotenumber + ' ' + @scope )

EXEC master..xp_cmdshell @command
EXEC master..xp_cmdshell @command2

