SQL Server 2008 R2 Writing To Text File
Posted
by
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
on Server Fault
See other posts from Server Fault
or by zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Published on 2012-02-07T17:27:46Z
Indexed on
2012/11/12
23:03 UTC
Read the original article
Hit count: 236
I used to write to text files from SQL Server using the code listed below:
DECLARE @FS INT --File System Object
DECLARE @OLEResult INT --Result message/code
DECLARE @FileID INT --Pointer to file
--Create file system object (OLE Object)
EXECUTE @OLEResult = sp_OACreate 'Scripting.FileSystemObject', @FS OUT
IF @OLEResult <> 0 PRINT 'Scripting.FileSystemObject.Failed'
-----OPEN FILE-----
EXECUTE @OLEResult = sp_OAMethod @FS, 'OpenTextFile', @FileID OUT, @FileName, 8, 1
IF @OLEResult <> 0 PRINT 'OpenTextFile.Failed'
It appears this is no longer supported in sql server 2008 r2. How should I export to text files in sql server 2008 r2?
Link claiming this is no longer supported: http://social.msdn.microsoft.com/Forums/en/transactsql/thread/f8512bec-915c-44a2-ba9d-e679f98ba313
© Server Fault or respective owner