Heres a quick example. Please forgive the GOTO's - its just an exampleIf you incorporate it in a sproc just use begin..end blocks and returnHTHJasper Smith DECLARE @fso intDECLARE @file intDECLARE @filename varchar(255) ; SET @filename='c:\test.txt'DECLARE @text varchar(255) ; SET @text='This is some text from SQL'DECLARE @hr intDECLARE @src varchar(255)DECLARE @desc varchar(255)EXEC @hr=sp_OACreate 'Scripting.FileSystemObject',@fso OUTIF @hr <> 0 GOTO ERROREXEC @hr=sp_OAMethod @fso, 'CreateTextFile',@file OUT, @filename,1IF @hr <> 0 GOTO ERROREXEC @hr=sp_OAMethod @file,'WriteLine',NULL,@textIF @hr <> 0 GOTO ERROREXEC @hr=sp_OADestroy @fileIF @hr <> 0 GOTO ERROREXEC @hr=sp_OADestroy @fsoIF @hr <> 0 GOTO ERRORGOTO DONEERROR:EXEC sp_OAGetErrorInfo @fsoSELECT hr = convert(varbinary(4),@hr), Source = @src, Description = @descDONE:PRINT 'File written'