I need to process some records (in a stored procedure) and then write some stats to a log file.
In this test, I get screen results but the testit.txt file is not created. any ideas?
CREATE PROCEDURE [orgfile] AS
declare @msg as Char(255)
DECLARE @var sysname, @cmd sysname
SET @Msg = "this is a test"
SET @cmd = 'echo ' + @msg + ' -o d:\testit.txt'
EXEC master..xp_cmdshell @cmd