Sp_OAMethod, AttachFile, Attachment Comes Through As Ascii Text

May 11, 2007



hey all.

im new to the ASP/SQL scene, so please bare with me.

i have to send an email (with two attachments) through sql server.

the mail arrives, but the attachments are not attachments... they are ascii text in the body. im using an existing stored proc, which apparently works. so there is no reason this shouldn't work.

The file exists, the path is correct. Its obviously seeing and reading the file (otherwise there would be no data to print as ascii)

thanks all.



Also, if you know of a better place where i can post this thread, please let me know

View 6 Replies


ADVERTISEMENT

Dropped Lines When NULL Ascii Value In Text File

Aug 11, 2006

Hello,

SQL SERVER 2000:
My problem is that I have to process a special text file every day which contains 0 ASCII values to separate fields. The DTS import program drops everything after the ascii 0 value in the row, but of course I need the entire row with all fields.
So how can I prevent the text file import task from dropping everything after the 0 ascii value?

Could you help me in this?

thank you

View 8 Replies View Related

Transact SQL :: Replace Column Value From ASCII Characters To Non ASCII Characters In Table?

Oct 22, 2015

I’m getting ASCII characters in one column of my table. So I want to replace same column value in NON ASCII characters.

Note – values in column must be same

View 10 Replies View Related

Sp_OAMethod

Oct 10, 2007

Hi Guys,

SET @psFilepath = 'C: est.txt'
SET @psFilepath = '\XXXXXShareTest est.txt'
EXECUTE sp_OAMethod @FileSystem , 'OpenTextFile' , @FileHandle OUTPUT , @psFilepath , 2, 1

If I set the file path to '\XXXXXShareTest est.txt', the above statement does not create the test.txt file. But If I set the Filepath to a local drive it works.

Is it possible to create the files on a Share using sp_OAMethod.

Thanks

View 2 Replies View Related

COM And Sp_OAMethod Problems...

Jul 18, 2001

Hi!
I have a COM object with one method that I want to call from a SQL Server 7 stored procedure.

The method in the COM object looks like,

(Public Sub getXmlData(sqlStr As String, xslPath As String, sourceID As String, sendMethod As String)

When I call this method from the SP I get an error,

Source: ODSOLE Extended Procedure
Description: sp_OAMethod usage: ObjPointer int IN, MethodName varchar IN [, @returnval <any> OUT [, additional IN, OUT, or BOTH params]]


The call in the procedure looks like,

EXEC @hr = sp_OAMethod @object, 'getXmlData',
@sqlStr ='SQL statement...',
@xslPath='C:Temp',
@sourceID='Test',
@sendMethod='file'

What do I do wrong?

Best regards,
Carl

View 1 Replies View Related

Problem With Sp_OAMethod

Aug 17, 2000

I am trying to call a working DLL from a stored procedure. The object is made, but when I invoke a method, I get an error message that I guess indicates that I am calling it incorrectly. But I can’t find what’s wrong:

The COM is TDMSQLUtil.dll and is registered on the server, and only has one class and one method.

Public Sub RemoveItems(ByVal ItemNumbers As String, ByRef Col1 As String, _
Col2 As String, ByRef Col3 As String, ByRef Col4 As String, ByRef Col5 As String, ByRef Col6 As String, ByRef Col7 As String, ByRef Col8 As String, ByRef Col9 As String)

I call it with:
1 ) Exec @HResult = sp_OACreate 'TDMSQLUtil.cHandleString', @Object out
(this does not return an error)

2) Exec @HResult = sp_OAMethod @Object, 'RemoveItems', @ItemNumbers, @Col1 out, @Col2 out, @Col3 out, @Col4 out, @Col5 out, @Col6 out, @Col7 out, @Col8 out, @Col9 out

The error I get is:
sp_OAMethod usage: ObjPointer int IN, MethodName varchar IN [, @returnval <any> OUT [, additional IN, OUT, or BOTH params]]

What am I missing? I followed the instructions in BOL, or at least, I tried to>

Any help greatly appreciated
Thanks,
Judith

View 3 Replies View Related

Sp_OAMethod Question

May 8, 2003

Where can I find a description of the methods and properties that are available for sp_OAMethod? I've looked in BOL and any other source I could think of but I come up dry everytime.

Sidney Ives
Database Administrator
Sentara Healthcare

View 2 Replies View Related

Why Can't I Load My DTS Job Using Sp_OAMethod

Jul 23, 2005

Hello,I was trying to user the code below to run a DTS job. The job failswhen I get to the piece of code that begins:EXEC @rc = sp_OAMethod @PackageToken,'LoadFromSQLServer', ...It looks like it tries to look for the DTS package, because it takes 45seconds to execute when the server name is correct, leading me tobelieve that it is properly finding the server. Am "MyDTSPackage" isthe name of I saved my DTS Package under save as. I enter it in thelist below using single quotes just like I enter the server name.I am wondering if it is a permissions issue. I am running the thisstored procedure from SQL Query Analyzer:EXEC usp_OATest(The Stored Procedure gets created without a problem...it is running itthat is causing issues.)The error message is the custom one that shows at theError:line.Also, master..xp_cmdshell 'DTSRun....' works fine, but I would like tobe able to use this other method.Thanks in advance for any help!RyanCREATE PROC usp_OATestASDECLARE @rc intDECLARE @PackageToken intDECLARE @GlobalVariableToken int--Load DTS PackageEXEC @rc = sp_OACreate 'DTS.Package',@PackageToken OUTPUTIF @rc <> 0 GOTO ErrorEXEC @rc = sp_OAMethod @PackageToken,'LoadFromSQLServer',NULL,'ServerName',NULL,NULL,256,NULL,NULL,NULL,'MyDTSPackage'IF @rc <> 0 GOTO Error <------ERROR DETECTED HERE--execute packageEXEC @rc = sp_OAMethod @PackageToken,'Execute'IF @rc <> 0 GOTO Error--destroy packageEXEC sp_OADestroy @PackageTokenIF @rc <> 0 GOTO ErrorGOTO DoneError:EXEC sp_OAGetErrorInfo @PackageTokenRAISERROR('Error during package preparation or execution', 16, 1)Done:RETURN(@rc)GOEXEC usp_OATest

View 1 Replies View Related

Sp_OAMethod Fails With 0x800A0046

Apr 18, 2008

I recently enabled OLE Automation on a SQLSERVER 2005 database in order to be able to create files directly from the DB. When I attempt to use the sp_OAMethod to open or create a file, it fails with an error code of 0x800A0046. The sp_OACreate 'Scripting.FileSystemObject' call does not return an error and returns a valid object handle. I'm guessing the error has something to do with Windows permissions but I'm not sure what I need to do to correct it?

View 3 Replies View Related

Problem With Sp_OAMethod 'WriteLine For Special Characters

Sep 20, 2007

I use sp_OAMethod 'WriteLine' to write some VARCHAR data into a file. The problem is, that when the VARCHAR data contains special characters like "äüö", they not not correctly written and the file, if its a xml file is invalid.

VARCHAR data is "Datei abholenDateiname prüfen"

Statements are:

SET @XMLComment = '<!-- TestCase :' + @param_TestCase + ' -->'

execute @OLEResult = sp_OAMethod @FileID, 'WriteLine', Null, @XMLComment

Output is: <!-- TestCase Datei abholenDateiname pr�->


Is there any workaround to have it read/write special characters correctly in the file?
Any help is appreciated.
Thanks.

Added later:
I found a way to do the same with bcp, but also that utility has problems with "äöü" characters.

View 1 Replies View Related

BCP With ASCII

Nov 8, 2006

People,

can I export data using BCP to ASCII file?

I'm looking for but I did not found...

Thanks

View 2 Replies View Related

How To Get ASCII Code

Jul 31, 2015

I want to know the individual character ascii code for  "нолайн" .

when i try to get using select ascii('л') it's return code as 63 which is not correct (ascii code 63 is for "?").

how to get ascii code for this.

View 2 Replies View Related

Sql Mail W/attachment

Sep 19, 2001

I'm trying to use the xp_sendmail and include a txt file as an attachment.
I can't get the procedure to work with the attachment.....any help would be greatly appreciated. this is what I have been trying to get to work.....Thanks!! Scott



exec master.dbo.xp_sendmail
@recipients = 'xyz@email.com',
@query = 'SELECT * FROM ape_pt_temp',
@subject = 'SQL Server Report',
@message = 'file attached',
@attach_results = 'true', @width = 250

View 1 Replies View Related

Can&#39;t Send Attachment With CDO

Sep 24, 2001

<CODE>
<FONT face="Verdana, Arial, Helvetica" color=midnightblue size=2>For some reason
this proc doesn't send attachment. Please advise.
<P></P>
<P><PRE id=code><FONT id=code face=courier size=2></pre>
<P></P><P>CREATE PROCEDURE [dbo].[sp_SendCDONTSMail]<BR>@Help [BIT] = 0,<BR>@From [VARCHAR](8000) = NULL,<BR>@To [VARCHAR](8000) = NULL,<BR>@Cc [VARCHAR](8000) = NULL,<BR>@Bcc [VARCHAR](8000) = NULL,<BR>@Subject [VARCHAR](8000) = NULL,<BR>@Body [VARCHAR](8000) = NULL,<BR> @Filename [VARCHAR](8000) = NULL,<BR> @Importance int = 0,<BR>@MailFormat [BIT] = 0,<BR>@BodyFormat [BIT] = 0<BR>AS<BR>DECLARE<BR>@Error [VARCHAR](150),<BR>@object [INT],<BR>@hr [INT]</P><P>IF @Help = 1<BR>BEGIN<BR>PRINT '<BR>Purpose:<BR>This porcedure will send an email using CDONTS.dll.<BR>Use as a replacement to xp_sendmail. It will allow you<BR>to send HTML emails from SQL<BR>'<BR>RETURN 1<BR>END</P><P>IF ((@From IS NULL OR @From = '') OR (@To IS NULL OR @To = '') OR (@Subject IS NULL OR @Subject = '') OR (@Body IS NULL OR @Body = '')) AND @Help = 0<BR>BEGIN<BR>SET @Error = 'sp_SendCDONTSMail requires parameters @From, @To, @Subject, and @Body.' + CHAR(13) + 'Please execute ''sp_SendCDONTSMail 1'' for syntax assistance.'<BR>RAISERROR(@Error, 16, 1)<BR>RETURN -1<BR>END</P><P>EXEC @hr = sp_OACreate 'CDONTS.NewMail', @object OUT<BR>EXEC @hr = sp_OASetProperty @object, 'From', @From<BR>EXEC @hr = sp_OASetProperty @object, 'To', @To<BR>EXEC @hr = sp_OASetProperty @object, 'CC', @Cc<BR>EXEC @hr = sp_OASetProperty @object, 'Bcc', @Bcc<BR>EXEC @hr = sp_OASetProperty @object, 'Subject', @Subject<BR>EXEC @hr = sp_OASetProperty @object, 'Body', @Body<BR>EXEC @hr = sp_OASetProperty @object, 'MailFormat', @MailFormat<BR>EXEC @hr = sp_OASetProperty @object, 'BodyFormat', @BodyFormat<BR>exec @hr = sp_OASetProperty @object, 'Importance', @Importance<BR>EXEC @hr = sp_OAMethod @object, 'AttachFile', @FileName <BR>EXEC @hr = sp_OAMethod @object, 'Send'<BR>EXEC @hr = sp_OADestroy @object</P></FONT></FONT>
</CODE>

View 1 Replies View Related

E-Mail Attachment

Mar 27, 2007

I wrote a procedure in Sql Server 2000 which sends an E-Mail to any E-Mail account. But I not able to send an attachment with the E-Mail. I dont have the code for attachment in the same procedure, as I searched on Google I not able to find out. Please help me for the same.
Waiting for your reply.

View 3 Replies View Related

Emailing An Attachment From DTS

Feb 7, 2006

I have a DTS package that runs 4x a day and generates an excel spreadsheet, renames that spreadsheet with a datetime stamp and then places it into a folder on our network. I have been asked to email that spreadsheet to someone everytime the package runs.

My question is what would be the best way to handle this and how do I ensure that whatever process I define grabs the correct file? The folder that the Excel file is being placed into has multiple files in it. Is there a way to tell SQL Server which file to grab and email?

Any thoughts or suggestions would be greatly appreciated! Thanks!



Frank

View 1 Replies View Related

How To Use T-sql To Email And Attachment

Aug 14, 2006

I am new to sql and want to write a stored procedure to email a database group an attachment of a report that was created. Can someone please point me in the write direction thanks.

View 4 Replies View Related

Convert An Ascii File To Sql

Oct 7, 2005

All,  I have to automatically grap a dbf or ascii file from my hard drive and then insert that into an already existing database table.  Does anyone know how to do this? The only thing I can find is to do it manually from enterprise manager, but I need to automate this.Thanks in advance!

View 1 Replies View Related

Removing ASCII Characters.

Feb 16, 2001

I've got one SQL Server 7.0 table with a "Decsciption" Column of length 4000. The values in this column contains "End of Line" ASCII Character. The ASCII Value of this character is 10. I'm not able to remove this ASCII Character. I tried by using REPLACE function. But i could not remove that character.

Any thoughts are welcome,

Regards,
Santha.

View 1 Replies View Related

Need Help With Ascii () And Char() Functions

Jul 4, 2002

Hello one and all,

I’m new to T-sql and need help understanding the CHAR() and ASCII functions.
I tried to run these commands to better understand them but I get the same results each time.
Here is the query with the char command

USE Northwind
SELECT FirstName + ' ' + LastName, + CHAR(13) + Address,
+ CHAR(13) + City, + Region
FROM Employees
WHERE EmployeeID = 1


Nancy Davolio
507 - 20th Ave. E.
Apt. 2A
Seattle WA

(1 row(s) affected)

Here is the same command without the char function.

USE Northwind
SELECT FirstName + ' ' + LastName, + address, + city, + region
from employees
where employeeID = 1

address city region
------------------------------- ------------------------------------------------------------ --------------- ---------------
Nancy Davolio 507 - 20th Ave. E.
Apt. 2A Seattle WA

(1 row(s) affected)


As you can see I get the same results back except for the column names being displayed.

Please help me understand this.

Thank you,

Eric Talley

View 1 Replies View Related

Setting FTP Task To Ascii

Aug 17, 2004

I have an file I FTP onto the server using a FTP task in my DTS package. The problem I'm having is the FTP task downloads using binary format, whereas I need it to download using ascii format. Binary is causing characters in the file to change, and my import is failing.

Any idea on how to set it to download as ascii?

View 2 Replies View Related

Converting Comp To ASCII IN SQL

May 30, 2006

Hi
I am importing data from mainframe using DTS the problem is that I am getting some COMP fields from the mainframe these are compressed data fields that are used to reduce storage space on the main frame. Can some one please help me understand how we can use DTS to solve this problem that is decompress it before transferring to table in SQL server.
any code in scripting language to help decompress this datatype will be really appreciated.

Thanks

View 2 Replies View Related

Ascii Values Problem

Nov 6, 2006

Dear all,
I've a different problem while writing some script.

actually i need all the currency symbols and its ascii values.
i downloaded from one website, it is showing correctly in msword.
but i'm not getting the same thind in EDITPLUS.

can any one guide me in this regard please?

Vinod

View 5 Replies View Related

Ascii Values Problem

Nov 6, 2006

Dear all,
I've a different problem while writing some script.

actually i need all the currency symbols and its ascii values.
i downloaded from one website, it is showing correctly in msword.
but i'm not getting the same thing in EDITPLUS.

can any one guide me in this regard please?

Vinod

View 2 Replies View Related

Ascii Character Query

Mar 18, 2008

item custclass totalcustclass
-------------------------
06-5841 INST-CLINPRAC 1
06-5841 INST-MKT/MEDIA 2
06-5841 PROGRAM 1
06-5841 STANDARD 4
06-5845 STANDARD 1
AX-048 INST-MKT/MEDIA 4
KT-048 PROGRAM 2
KT-048 STANDARD 4

i want condition like if item is starting with number then totalcustclass whcih is count(*) remain same giving correct results...but if item startign with ascii character then totalcustclass r getting double so i have to /2..

i want results:

item custclass totalcustclass
-------------------------
06-5841 INST-CLINPRAC 1
06-5841 INST-MKT/MEDIA 2
06-5841 PROGRAM 1
06-5841 STANDARD 4
06-5845 STANDARD 1
AX-048 INST-MKT/MEDIA 2
KT-048 PROGRAM 1
KT-048 STANDARD 2

select
item, custclass,

case when item is <ascii> then count(custclass)/2
else count(custclass)
as totalcustclass

from itemcustclass

can anyone tell me what condition will come in case?

thanks for help.

View 2 Replies View Related

Import ASCII Data

Aug 29, 2006

I have data that comes from a legacy system. I can obtain the data in anASCII format. Currently I have created scripts in ACCESS to import the datainto tables.What I would like to do is create an automated import function in SQL.I am new to SQL, can anyone point me in the direction I should look to findout how I could perform this task?Using SQL 2005.ThanksMatt--Matt Campbellmattc (at) saunatec [dot] comMessage posted via http://www.sqlmonster.com

View 2 Replies View Related

Issue With Ascii 7 Files

Sep 14, 2006

Hi All,

I need to generate Ascii 7 bit flat file, based on data in db, using integration services, FTP task. Currently i am generating file with ansi-latin and then using the script task converting it to the ascii 7. File looks to be generated properly. But when the target system reads this, they complain that the file has junk charecters some thing like this. when i open it after generating the file it looks fine to me in DOS also. I dont know what is the target system and what OS is used by them. what cud be the issue for these junk charecters and is it possible that a Ascii 7 file generated by windows doesnt work in other OS? If the method i am doing to generate the ascii 7 is not currect then what is the best method for this?

ÿþH^@D^@R^@|^@1^@E^@N^@I^@N^@A^@|^@O^@|^@2^@0^@0^@6^@-^@0^@9^@-^@1^@3^@

PS: earlier i had generated a flat file using data export from Excel & that worked in the target system well. is there any difference in the file encoding generated by excel and integration services?

Please help me!!!!

-vinu

View 1 Replies View Related

Convert Between ASCII And EBCDIC

May 5, 2006

I am working on a project that will be mimicking an existing interface that we have with one our our clients. That interface today sends EBCDIC packed fields. We do not want to introduce changes to the external clients interface file when we rebuild it in SQL 2005 Integration Services and I need to find out how I can take ASCII data and convert it to the host (mainframe) representation, which is what we currently provide to our external client using Integration Services.

Has anyone had to do this? If so, can I accomplish it natively with SSIS, or do I need to look to a third party vendor for a component?

Thanks,

John

john.minker@choosebroadspire.com

View 3 Replies View Related

Mail Attachment With CDOSYS

Feb 27, 2006

Hi,
I am using the following stored procedure to send a mail with attachment. But the mail is sent without the attachment. Can anyone help me?

CREATE PROCEDURE DBO.sp_Send_Mail_test(
@p_From as nvarchar(50),
@p_To as nvarchar(50),
@p_Subject as nvarchar(255),
@p_Body as varchar(1000),
@p_CC as text = null,
@p_BCC as text = null,
@p_Attachment varchar(500)=null
)
AS
Declare @Message int
Declare @hr int
Declare @source varchar(255)
Declare @description varchar(500)

EXEC @hr = sp_OACreate 'CDO.Message', @Message OUT

EXEC @hr = sp_OASetProperty @Message, 'From',@p_From

EXEC @hr = sp_OASetProperty @Message, 'To', @p_To

EXEC @hr = sp_OASetProperty @Message, 'Subject', @p_Subject

EXEC @hr = sp_OASetProperty @Message, 'TextBody', @p_Body

EXEC @hr = sp_OAMethod @Message, 'CDO.Message.Attachment.Update', Default, @p_Attachment

If @p_CC is not null
BEGIN
EXEC @hr = sp_OASetProperty @Message, 'CC',@p_CC
END

If @p_BCC is not null
BEGIN
EXEC @hr = sp_OASetProperty @Message, 'BCC',@p_BCC
END

EXEC @hr = sp_OAMethod @Message, 'Send', NULL

EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description out


EXEC @hr = sp_OADestroy @Message
IF @hr <> 0
BEGIN
SELECT hr=convert(varbinary(4),@hr), Source=@source, Description=@description
RETURN
END

Regards,
Bharathram G

View 1 Replies View Related

SQL Mail With Attachment Not Working

Apr 22, 2004

Hi,

I am able to send normal mails from SQL Server with no attachments.

But when i am trying to send mail with an attachment i get following error.

Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80004005

I am running SQL Server 2000 , SP3.

select @@version
---------------------------------
Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 4)



exec master..xp_msver
------------------------------------------
Index Name Internal_Value Character_Value
------ -------------------------------- -------------- ------------------------------------------------------------------------------------------------------------------------
1 ProductName NULL Microsoft SQL Server
2 ProductVersion 524288 8.00.760
3 Language 1033 English (United States)
4 Platform NULL NT INTEL X86
5 Comments NULL NT INTEL X86
6 CompanyName NULL Microsoft Corporation
7 FileDescription NULL SQL Server Windows NT
8 FileVersion NULL 2000.080.0760.00
9 InternalName NULL SQLSERVR
10 LegalCopyright NULL © 1988-2003 Microsoft Corp. All rights reserved.
11 LegalTrademarks NULL Microsoft® is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation
12 OriginalFilename NULL SQLSERVR.EXE
13 PrivateBuild NULL NULL
14 SpecialBuild 49807360 NULL
15 WindowsVersion 143851525 5.0 (2195)
16 ProcessorCount 1 1
17 ProcessorActiveMask 1 00000001
18 ProcessorType 586 PROCESSOR_INTEL_PENTIUM
19 PhysicalMemory 254 254 (266850304)
20 Product ID NULL NULL

(20 row(s) affected)



Any help would be helpful.

Regards
Jay

View 2 Replies View Related

Problem With Sp_send_dbmail With Attachment

Aug 2, 2007

Hi,

We have a DTS package in the old SS2000 that we are still using in SS2005. We change the old xp_sendmail to use the new sp_send_dbmail. This runs fine without attachment. But with attachment, I'm encountering an error when running the package.

The task reported failure on execution.
The client connection security context could not be impersonated. Attaching file requires an integrated client login.
Syntax error or access violation.

I cannot find much topic on the net about this error.

Thanks very much for any help.

Regards

View 1 Replies View Related

SSIS : How Do I Use Mailto With Attachment

Sep 28, 2007

Hi,
In SSIS Scipt task, with all variables assigned.

With the below code i was able to send mails, But after receiving it, there is no Attachment.

N.B:- Similar issue is raised by some other guy in

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2157275&SiteID=1

"http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2155181&SiteID=1"

and i dont think he got the resolution.


Public Sub Main()

Dim smtpServer As String = Dts.Variables("MailSMTPServer").Value.ToString
Dim htmlMessageTo As String = Dts.Variables("ToLine").Value.ToString
Dim htmlMessageFrom As String = Dts.Variables("FromLine").Value.ToString
Dim htmlMessageSubject As String = Dts.Variables("MailSubj").Value.ToString
Dim htmlMessageBody As String = Dts.Variables("MailBody").Value.ToString
Dim htmlMessageLog As String = Dts.Variables("ErrorLog2").Value.ToString
Dim htmlMessage As MailMessage
Dim mySmtpClient As SmtpClient
Dim m As New System.Net.Mail.MailMessage
Dim AttachLog As Attachment = New Attachment(htmlMessageLog)

htmlMessage = New MailMessage(htmlMessageFrom, htmlMessageTo, htmlMessageSubject, htmlMessageBody)

mySmtpClient = New SmtpClient("<SMTP Server name>")
m.Attachments.Add(AttachLog)

mySmtpClient.Credentials = New NetworkCredential("<emailid>", "<password>")

mySmtpClient.Send(htmlMessage)

Dts.TaskResult = Dts.Results.Success
End Sub

Please let me know, how can i see Attachment in my mail.

Thanks.

View 1 Replies View Related

Dynamic File Name For Attachment

Sep 7, 2007

hi

I am encountering the same problem above and I did exacly as described . But it is not working.

I must send emails every month with dynamically named files as attachments.
The files are named according to the date on which they are generated.
For example on the first of November 2007, the file will be named myfile_1_11_2007.

I have created a variable called DynamicFileName with package scope, data type string and default value: d:\tests\

In "Send Mail Task Editor" Dialog Box, I have specified the following:

smtpConnection: smtptest.server.com
From :nemo@smtptest.server.com
To: nemo@smtptest.server.com
Subject: Dynamic File Email
MessageSourceType: Variable
MessageSource: blank
Priority: blank
Attachments: blank

In Expressions, I have specified:

FileAttachments: @[User:ynamicFileName] + "myfile_" + (DT_STR, 4, 1252) DAY( GETDATE() ) + "_" + (DT_STR, 4, 1252) MONTH( GETDATE() ) + "_" + (DT_STR, 4, 1252) YEAR ( GETDATE() ) + ".csv"

When I execute the package, I get the following errors:
-----------------------------------------------------------------------------------------
Error at Send Mail Task [Send Mail Task]: Either the file "d:\tests\myfile_1_7_2007.csv" does not exist or you do not have permissions to access the file.


Error at Send Mail Task: There were errors during task validation.
---------------------------------------------------------------------------------------------------

Of course, the file does not exist. It will exist at tun-time. How can I tell the Send Mail Task to use a filename that is dynamic ?

By the way, once I have specified the code for FileAttachments, on trying to edit the Send Mail Task Properties, I can see that the Atachments field has been set to "d: estsmyfile_1_7_2007.csv by itself: I never typed it there !! It seems that the task executes the code even before it is run. If I remove the attachment path manually, on running the dts, I get an error saying that "either the file does not exist or you do not have permission to access the file.


I would be most grateful if anyone could be of help

thanks

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved