With Due apologies for Tlbroadbent and other members for not providing adequate information in an earlier post...
-----------------
SQL 2000
Windows 2000
Visual Studio 6 SP5.
-----------------
The idea is to send an email of the contents of a table. No, VB executable is not permitted. And No again. Exchange server may not be properly configured in the clients place. Their exchange server has limited access. Dirty situation, yeah.
I managed to write an SP(found in MSDN, "Sending mail without SQL Mail"
to send email with the query results. Here is the catch. If the query yields more than 8000 characters, it would truncate. I thought I would create a text file containing the result of the query and send it as an attachement.
So I'm trying to use the following code to create a TextFile. But it won't work. Could you please tell me where the mistake is ?
Or if there is any other way to do this, please tell me. Much Thanks.
Thank you,
RR.
__________________________________
The best is yet to come.
-----------------
SQL 2000
Windows 2000
Visual Studio 6 SP5.
-----------------
The idea is to send an email of the contents of a table. No, VB executable is not permitted. And No again. Exchange server may not be properly configured in the clients place. Their exchange server has limited access. Dirty situation, yeah.
I managed to write an SP(found in MSDN, "Sending mail without SQL Mail"
So I'm trying to use the following code to create a TextFile. But it won't work. Could you please tell me where the mistake is ?
Or if there is any other way to do this, please tell me. Much Thanks.
Code:
CREATE PROCEDURE [dbo].[sp_CreateTextFile]
@FileName varchar(100),
@FileContent varchar(8000)
AS
Declare @FSO int
Declare @TextFile int
Declare @hr int
EXEC @hr = sp_OACreate 'Scripting.FileSystemObject', @FSO OUT
EXEC @hr = sp_OAMethod @FSO, 'CreateTextFile', @FileName,NULL, @TextFile OUT
EXEC @hr = sp_OAMethod @TextFile, 'WriteLine', @fileContent, NULL
EXEC @hr = sp_OADestroy @FSO
GO
RR.
__________________________________
The best is yet to come.