I have a SQL 2000 DTS which I imported in SSIS. The data transformation tasks were not converted, but saved as SQL 2000 transformation tasks. I want to re-write this, so that it is in compliance with 2005 standards. My problem is, I can't figure out how to capture data from a SQL task, and refer to its result set in a script task. Specifically, I want to capture data by querying a view, then refer to 2 fields in that result set in a script. I want to then transform a code into a full description, and write the transformed data to an Excel destination. The vbScript code that I used in 2000 is as follows:
' Copy each source column to the destination column Function Main() dim vEssenCode, vEssenDesc vEssenCode = DTSSource("Essential_Code") If vEssenCode = "E" Then vEssenDesc = "EOC - Able to Perform" Elseif vEssenCode = "D" Then vEssenDesc = "Dept - Able To Perform" ElseIf vEssenCode = "1" Then vEssenDesc = "EOC - Not Able To Perform" ElseIf vEssenCode = "2" Then vEssenDesc = "Dept - Not Able To Perform" Else vEssenDesc = "Non-Applicable" End If DTSDestination("Essen_Code") = vEssenDesc Main = DTSTransformStat_OK End Function
This worked fine until recently, but now always returns "Non-Applicable". Does anyone have any suggestions as to how I can accomplish this? I think that I have to create a data flow task with an OleDB source, send its output to an SQL Task, then send its result set to the script, do the transformation, and, finally, send its output to an Excel destination. Any suggestions will be greatly appreciated!!
in my execute sql task, i have a try catch statement to catch error code if there's an error...
begin try insert into person.contact (contactid) values ('1')
end try begin catch
select @@error as ErrorCode end catch
this ErrorCode will be mapped to a user variable.
my problem is the value for ResultSet.
in order to assign ErrorCode to the variable, i have to set the ResultSet value to Single row, but if this task does not fail, i need to set ResultSet value to None in order for it to run successfully.
Hello! I would like to write a value from a column to a parameter in SSIS with the Execute SQL task. The problem is that I will never get a value for the parameter.
You can recreate the problem with the AdventureWorksDW sample database.
1. Drop an execute SQL task in the control flow
2. Set the connection to the AdventureWorksDw database
3. Write this in the SQL Statement box Select Max(FullDateAlterNateKey) as LastDate
From DimTime 4. Set the resultset to single Row 5. Under result set assign LastDate as the Result Name and create a parameter with a default date. 6. Execute the task, that will finish succesfully but the value of the parameter in 5 have not changed.
I have tried to change the scope to both the package level and the task level without any success. The value of the variable is still the default value. I have also tried a string variable without sucess.
I need to loop the recordset returned from a ExecuteSQL task and transform each row using a Data Conversion task (or a Script Task).
I know how to loop the recordset returned by an ExecuteSQL task:
http://www.sqlis.com/59.aspx
I loop the returned recordset (which is mapped to a User variable of type System.Object) and assign the Variable Mappings in the ForEach Loop to different user variables which map to the Exec proc resultset (with names and data types).
I assume to now use these as the Available Input columns for the Data Conversion task, I drag a Data Flow task inside the For Each Loop container and double-click it, then add a Data Conversion task.
But the Input columns (which I entered in the Variable Mappings in the ForEach Loop containers) dont show up in the Available Input columns of the Data Conversion task.
How do I link the Variable Mappings in the ForEach Loop containers from the recordset returned by the Execute SQL Task to the Available Input columns of the Data Conversion task?
.......................
If this is not possible, and the advice is to use the OLEDB data flow as the input for the Data Conversion task (which is something I tried too), then the results from an OLEDB Command (using EXEC sp_myproc) are not mapped to the Available Input columns of the Data Conversion task either (as its not an explicit SQL Statement and the runtime results from a stored proc exection)
I would like to use the ExecuteSQL task to do this as the Package is clean and comprehensible. Which is the easiest best way to map the returned results from a Stored proc execution to the Available Input columns of any Data Flow transformation task for the transform operations I need to execute on each row of data?
[ Could not find any useful advice on this anywhere ]
I am creating a simple SSRS table report through Report Builder. My dataset is looking for the stored procedure . When I execute the Stored procedure through SSMS I get resutset for certain parameters. I execute the dataset (Store procedure) through query designer in dataset properties and I get results back. But when I try to run the report and see the preview, I do not get any results displayed. I been looking on the same issue form last 3-4 days and have not found any clue.
Following is the stored procedure I am using. Also I am passing multivalued parameter through report as well, and I am using spilt function to seperate the libraryid I am reading from parameter values. This works fine. I have similar kind of four other reports and with different stored procedure which exactly follow the same method , like multivalue parameters and other criteria are also very similar. All other reports works just fine.. This perticular report has issue for displying results, following is the stored procedure I am using
I have a pretty simple process that copies some files from an AS400 to a directory on the same server where my sql 2005 instance lives. I then use an email task to send these files to a client.
However, the email task does not work. I get the following message:
[Send Mail Task] Error: Either the file "BYNSOSR1;BYNSOSR2;BYNSOSR3;BYNSOSR4;BYNSOSR5;BYNSOSR6;BYNSOSR7" does not exist or you do not have permissions to access the file.
Well, the files definitely exist where they are supposed to be so I guess it's a permissions error. However, I have no clue which user would need permissions on that directory. As a test, I gave everyone read permissions and still got this error.
Any suggestions about which user I need to allow read access to the directory where these files exist?
I am generating the text file on run time using flat file destination. The text file is generated on the location C: SSIS or D:SSIS based on the location specified in the configuration file.
The text file contains the non matching rows during lookup transform task.
I want to send this dynamically generated text file using the send email task.
But while doing this, I receive an error during package validation:
Package validation error:
Error at send email task [ send email task ] : either the file C:SSISErroroutput.txt does not exists or you do not have permission to access the file.
Error at send email task ; There were error during task validation.
Please suggest as I need to generate the text file only in case of lookup failure.
Wondering if it is by design that when I select messagesource to be variable it only shows user variables or if there is some setting I'm missing to expose the system variables?
This email task is on the eventhandler tab. Thanks
I have just created and tested a package that uses the Send Email Task and it works fine in our dev environment - I guess this is expected as I am an admin on my machine and have rights on our mail server. But Im trying to document the considerations for rolling this out into a customer production setting.
Is anyone familiar with the security considerations or can point me in the direction of some documentation?
For example, presumably the SQL Server Agent Windows Account will need rights to contact the mail server? Will it need its "own" email account or can you just put any valid email addy in the from box? Presumably the account will need the right permissions to access the attachement file too?
Do these sound like relevant considerations to pass on to customer DBAs/system admins? Anything else Ive missed, am I worrying to much?!
How can I programmatically change the properties of Send Mail task using Script Task. I want to change the From, To and Attachment parameters of the Send Mail task.
If the Script Task can't do it, Is there any alternative to do?
I am trying to explore the email task in SSIS. I have a task which has only the email task. When I run its not throwing any error instead it says successfuly run but I am not recieving mail. I dont know how to trace this, could someone help me on this?
I have a SSIS package in which at the end i have a excel destination task which imports a table data in excel files and then send it as an attachment using email task but i am facing a issue which is mentioned below -
1. The SSIS package runs as a SQL server agent job once in a day now every time the job runs i need to creat a new excel ( or delete the older one create again ) import data in that excel using Excel destination and then send it as an attachment using email task , How can i dynamically change the excel destination to point to a template file or new file
2. WIth the email task i am able to send only one attachment , i tried seperating the file names using semi colon but it is giving error "You dont have permission to access the file or file does not exists"
SSIS : I have a "On Failure" precedence constraint that executes a Send Email Task for a Data Flow Task. Do you know how I might capture the error message from the Data Flow Task to include it in the Email (most likely as a variable)?
I am setting the 'To' field in the Send Email task using an expression in the expression textbox because the email address is received from a variable.But the taks throws error, as the 'To' field in the task is empty and only the expresssion field is filled. Is there any workaround ?
I currently have a simple cdosys email task that has been scheduled to send a simple email from ssis. The email is sent using an activex script in a "SQL 2000 DTS Package Task". When executed manually, the email is sent ok. When scheduled (and run under our SQL agent account), it fails. Can anyone point me in the right direction? Is this a permissions issue?
'-- this script seems to cause problems, but only when scheduled -- dim mailer set mailer = CreateObject("CDO.Message") dim cdoconfig const cdoDispositionNotificationTo = "urn:schemas:mailheader:disposition-notification-to" const cdoReturnReceiptTo = "urn:schemas:mailheader:return-receipt-to" set cdoconfig = CreateObject("CDO.Configuration")
with mailer set .Configuration = cdoconfig .BodyPart.charset = "unicode-1-1-utf-8" .BodyPart.ContentTransferEncoding = "quoted-printable" .Fields("urn:schemas:httpmail:importance").Value = 2 .Fields.Update
.Subject = "Notification" .From = "donotreply@test.com" .TextBody = "TEST" .Bcc = "someone@test.com" .Send end with '-------------
Also, since I have several DTS packages that are similar, I'd like to keep these packages in the SQL 2000 dts format, instead of converting them into SSIS format and using database mail.
I have an Execute SQL Task that saves the results in a variable such as, RecCounts.
I have a Send Mail Task with a message source of: [User::RecCounts]
However, when I run the package I get this error.
Error: Failed to lock variable "[User::RecCounts]" for read access with error 0xC0010001 "The variable cannot be found.
This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".
Hi All, I need to send out email when error occurs in the package. Is it a good practice to put the send email task in the event handler? Then MaximumErrorCount is set to 1. But for some reason, some time I saw more than one email are sent out. Please advise. Thanks
The Browser role has the task Manage Individual Subscriptions. Fine, the user can create a subscription. The problem is that the reportserver populate the email address text box with the Windows User ID and does not let the user change this to put his email address instead. The text box is greyed out.
I found that to enable the text box I have to add the task Manage all subscriptions to the role "Browser".
This is a major security problem because with this setting any user can edit any subscription.
I suspect that I could work at the Active Directory level to populate a field that would in turn populate the email address with the correct data., however this is not an option for me. I have absolutely no way to do it or get it done. Does anybody has an idea on how I could allow a user to edit his email address in his subscriptions and not let him tamper with other users subscriptions?
I am implementing a fax solution (Right Fax) and pulling email information from a table and passing into a variable. In order to send out a fax via email, the syntax is in the following example below:
Example:
To send a fax from Outlook to Jane Doe at 555-1212, enter:
[RFAX:Jane Doe@/FN=555-1212]
When the following syntax gets passed into the Send Mail Task, into the "To" line and the package is executed I'm receiving the following.
[Send Mail Task] Error: An error occurred with the following error message: "The specified string is not in the form required for an e-mail address.".
[Send Mail Task] Warning: The address in the "To" line is malformed. It is either missing the "@" symbol or is not valid.
I realize it’s a malformed email address. Is it possible to create a group and instead of the fax syntax pass the group name?
I'm trying to put together an SSIS package that will look in one directory for 2 distinctly named .csv files. The files will then be loaded into 2 tables.
The first task I execute is a SQL Task that checks to see if the tables I'm loading the data into are empty. If the tables have data, the package stops executing. If they are empty, the package continues to execute.
What is the best way to send an email out from SSIS if the package stops on the first step?
Exec Prcoess task with source : ftp destination :ftpunzip work directory ftpunzip executable : c:Program FilesWinZip
i am using expressing.
It is doing the unzip but getting this error
package process on server server1 has failed within the Task 'Unzip Files' with the following errors: > > File/Process "WZUNZIP.EXE" does not exist in directory "c:Program FilesWinZip".
I have a report that gets sends out through a subscription and sometimes the report has multiple pages and all those pages appear within one email.Is it possible to set the subscription in such a way that an email is sent per page when the subscription executes.
Under IIS SMTP I can set bounced email redirect etc. how to do that with dbmail, the idea is I can get the list of bounced emails somewhere so I can create a report.