N.suresh
ssis package optemization
SSIS Package fails on C# Script Task
I have a package that creates an Excel sheet (via a T-SQL task) then loads data into it. The customer has specific header requirements which want the spreadsheet designed as such:
ReportName Covers StartDate through EndDate
Name Zip Program SignupDate
The first line is a single column with the second line being 4 separate columns. Now, I can design the spreadsheet to do this, but I end up getting this:
Name Zip Program SignupDate
ReportName Covers StartDate through EndDate
Name Zip Program SignupDate
Two sets of column headers. I've got a fix for it. My devs helped me write a C# program to delete that top "extra" header. The package runs fine from my desktop in BIDS. But when I try to run it on my server, I get the following error:
Error: 2012-10-22 06:23:17.51
Code: 0x00000001
Source: Remove Duplicate Header Row
Description: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
at ST_611a78a7dcaf4b57924f38e8064b3560.csproj.ScriptMain.Main()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
End Error
And the code for the step is:
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;
namespace ST_611a78a7dcaf4b57924f38e8064b3560.csproj
{
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
#region VSTA generated code
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion
public void Main()
{
Excel.Application application = new Microsoft.Office.Interop.Excel.Application();
application.Visible = false;
Excel._Workbook workbook = application.Workbooks.Open(Dts.Variables["NewFileName"].Value.ToString(),
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
Excel._Worksheet worksheet = (Excel._Worksheet)workbook.Worksheets["Motor"];
worksheet.get_Range("A1", "D1").Font.Bold = true;
worksheet.get_Range("D:D", Missing.Value).ColumnWidth = 25;
worksheet.get_Range("A1", "D1").ColumnWidth = 8.5;
worksheet.get_Range("B1", "B1").set_Value(Missing.Value, "New Header");
worksheet.get_Range("A1", "A1").EntireRow.Delete(Excel.XlDirection.xlUp);
workbook.Save();
application.Quit();
worksheet = null;
workbook = null;
application = null;
Dts.TaskResult = (int)ScriptResults.Success;
}
}
}
I don't know if this has anything to do with the error, but our server setup is a little odd. We have a database server, an application server, and a NAS share. The app server runs the package (after connecting to the db server) and then creates the Excel sheet on our NAS share. Everything works fine with this package until it tries to alter the Excel file out on the NAS share. I've tried everything. Even changing the code from VB to C#. Nothing appears to be working when the package is run from the job on the app server.
Does anyone have any thoughts on what the issue could be?
MCITP:DBA, MCDBA, MCSA
SSIS - CONNECTION STRINGS ISSUE
I am migrating a sql2005 SSIS package to sql2008 version but I need a clarification on the connection strings.
In 2005 version, I have the following which works fine:
Data Source=SALESDB\SQL2005,5533;Initial Catalog=DAILYSALES;Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False;
But after migration to 2008, I created the 2008 version using SQLNCLI10.1 from connection manager(instead of SQLNCLI.1) and I got the following:
Data Source=SALESDB\SQL2008,5533;Initial Catalog=DAILYSALES;Provider=SQLNCLI10.1;Integrated Security=SSPI;Application Name=Location_Data_Load-{531332AE-4C87-4077-8481-1CF896D2E576}SALESDB\SQL2008,5533.DAILYSALES;Auto Translate=False;
This looks complex to me even though it may be working in dev. Please, does any one know why package/application name, id and duplicate server name were included in the connection string? If I remove them, will there be any impact?
I tried this:
Data Source=SALESDB\SQL2008,5533;Initial Catalog=DAILYSALES;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;
and it seems to connect (though I haven't tested the entire load package. Thanks
oledb destination
hi,
my oledb destination gets right data.
but not in order , i have identity column,so when first record insert it should 1 on the first row.
but i am not getting it.
when i query it by using order by then only i can see it properly.
hoever in data viewer i can see it properly
any solution
convert decimal to 2 digit
hi
my column has a value like this
1
56
43
2.33333333333333333
5.6789
now i want that numbers who has decimal should be only 2 digit, but integer number should remain same.
only decimal number should be round to 2
insert from 1 database table into another databse table
hi,
i need to isnert data from 1 database table to another database table using condition
insert
(
[Code],ProductName)
select
Format,Name
from
[CS].[dbo].[Master]
where
[CS].[dbo].[Master].Format!=Rx.dbo.Stage1.[Code] getting error the multipart identifier Rx.dbo.Stage1.[Code] count not be bound
into [Rx].[dbo].[Stage1]Informix odbc from SSIS Ado.net Source
Hi Guys,
I am trying to getting get data from Informix ODBC 3.7TC to Sql server database using ssis but got a syntax error as below.
ERROR [42000] [Informix][informix ODB Driver] [Informix] A systax error has occured iclt09b.dll
Its working fine when using MS Access 2010.
Please let me know if I am missing something.
Thanks
Tinku.
How to load multiple rows of order data with same info on each row for order but only product info is different?
Hi,
I am newbee to SSIS so i hope the experts go easy on my lame question. I am getting my order information in an excel file in the following format and order and i need to load these into orderheader (OrderNumber, CustomerID), customer(customerid, customerFirstname, customerlastname) and orderDetail (product infomation) tables. In C# i used to load this by reading the data one row at a time and checking for ordernumber and loop through rest of the info if that remained the same as pervious. Now i am trying to move to SSIS and was wondering if there's a better approach that i can use or should i be using script control.
Any guideance would be greatly appreciated.
Thanks.
OrderNumber CustomerID CustomerFirstName CustomerLastName Product ID Model No Serial No
Date of Purchase
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
000001 A1 John
Doe 111
1x1x1x 1s1s1s 11/1/2012
000001 A1 John Doe 112 1x1x2x 1s1s2s 11/1/2012
000001 A1 John Doe 113 1x1x3x 1s1s3s 11/1/2012
000001 A1 John Doe 114 1x1x4x 1s1s4s 11/1/2012
000001 A1 John Doe 115 1x1x5x 1s1s5s 11/1/2012
000001 A1 John Doe 116 1x1x6x 1s1s6s 11/1/2012
000002 A2 John1 Doe1 111 1x1x1x 1s1s1s 11/1/2012
000002 A2 John1 Doe1 112 1x1x2x 1s1s2s 11/1/2012
000002 A2 John1 Doe1 113 1x1x3x 1s1s3s 11/1/2012
000002 A2 John1 Doe1 114 1x1x4x 1s1s4s 11/1/2012
000002 A2 John1 Doe1 115 1x1x5x 1s1s5s 11/1/2012
000002 A2 John1
Doe1 116
1x1x6x 1s1s6s 11/1/2012
Benefits of SSIS
data mismatch
hi,
when i run package i see data in data viewer,but when i see in the table,its mismatch.
some of the column has different number then what i see in data viewer .
i check mapping ,everything is correct
data conversion error
i am getting this error
Data conversion failed while converting column "NAME" (176) to column "Copy of NAME" (15). The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
Error: 0xC0209029 at
this has string(dt_str) 600 in flat file output column.
in my tabl eit is nvarchar(50).
what should i change
Package Validation Error (Package Validation Error) - cannot convert between unicode and non-unicode string data types.
Hello,
This application looks straight forward enough but when I try to run a package to test a simple import of 2 columns from a flat file to a table, I get the following error
Package Validation Error (Package Validation Error)
===================================
Error at Data Flow Task [OLE DB Destination [601]]: Columns "EMPLOYEE_BAR_CODE" and "EMPLOYEE_NO" cannot convert between unicode and non-unicode string data types.
Error at Data Flow Task [OLE DB Destination [601]]: Columns "EMPLOYEE_DISPLAY_NAME" and "EMPLOYEE_NAME" cannot convert between unicode and non-unicode string data types.
Error at Data Flow Task [SSIS.Pipeline]: "component "OLE DB Destination" (601)" failed validation and returned validation status "VS_ISBROKEN".
Error at Data Flow Task [SSIS.Pipeline]: One or more component failed validation.
Error at Data Flow Task: There were errors during task validation.
(Microsoft.DataTransformationServices.VsIntegration)
------------------------------
Program Location:
at Microsoft.DataTransformationServices.Project.DataTransformationsPackageDebugger.ValidateAndRunDebugger(Int32 flags, DataWarehouseProjectManager manager, IOutputWindow outputWindow, DataTransformationsProjectConfigurationOptions options)
at Microsoft.DataTransformationServices.Project.DtsPackagesFolderProjectFeature.ExecuteTaskOrPackage(ProjectItem prjItem, String taskPath)
here is my table schema for the 2 columns
CREATE TABLE [dbo].[MY_EMPLOYEES](
[MY_EMPLOYEES_KEY] [int] IDENTITY(1,1) NOT NULL,
[EMPLOYEE_NO] [nvarchar](50) NULL,
[EMPLOYEE_NAME] [nvarchar](50) NULL,
[DATABASE_MAINTENANCE] [bit] NULL,
....
What could be wrong?
add output columns to transformation service package
I'm design a package to import data from an excel file to SQL server table. The excel file has about 20 columns. The SQL server table has more than 150 columns. So I need set default values to a lot of columns. And also I need process some other columns before import into destination table. Only a few columns will be directly copied in.
I have been trying use Derived Column transfer and Script Component. However, in both design user interface, I have to type in column name to output set on either way. I need type in more than 60 columns and choose data type for each column.
Is there any better way to do this? Is there anyway to grab columns from destination table?
Or is there any other transformation can do this easily?
Thanks
Variable's value inside script - to take it out of script?
Hi,
I need to know, If I am stuffing data to a text files and I am trying to take the whole thing to a variable declared inside the script task.
(Because of the restriction to 4000 characters for a SSIS variable)
Here i need to mail the whole content through 'Send Mail Task'
Here i need to know how can i take the value of the variable to which we have pushed all data using script task for using that as content of the mail in Send Mail Task?
Thanks !
--------------------------- Radhai Krish | Golden Age is no more far | --------------------------
import multiple excels into single sql server table using ssis 2008
Hi,
I have a doubt.
i want how to import the multiple excel file into sql database.(sql 2008)
i have 2 excel files. i have used the foreach loop container , but while am executing it showing the records from the first excel twice . it is not fetching the second excel sheet from the folder. am expecting the records from both excel sheets into table.
i have use the vatiable. filepath this variable contains the filepath with excel sheetname.
Thanks.
Abdul Khadir.
SSIS Programming - List of STOCK moniker values
I've been looking into programmatically creating SSIS packages. The Executables.Add method can take something referred to as a STOCk moniker as an input parameter http://technet.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.executables.add.aspx
Does anyone know if there is a published list of all the monikers for the "out-of-the-box" components?
Adam Tappis. (MCSD VB6 & .NET, MCDBA SQL 2000)
import csv file use ssis why 04-2302 change to Apr-02
SSIS Sequence Container added inside the For Loop Container programmatically is not visible in the design view in BIDS, but I can see it in Package explorer.
I have created a SSIS package named “PackageA” withFor Loop container (“FLC”) in SSIS BIDS then saved asC:\ PackageA.dtsx.
My requirement is to add a Sequence container inside the For loop container programmatically.
I have added theSequence Container (“STOCKEQUENCE”) inside the For loop container programmatically with below mentioned code and saved the new package with name “PackageB” and saved asC:\ PackageB.dtsx.
Code:-
Application app =new Application();
string path =@"C:\ PackageA.dtsx";
Microsoft.SqlServer.Dts.Runtime.Package pkg = app.LoadPackage(path,null);
Executable exec = pkg.Executables["FLC"];
(exec as IDTSSequence).Executables.Add("STOCKEQUENCE");
app.SaveToXml(@"C:\ PackageB.dtsx", pkg,null);
Here the issue is…
In design view of “PackageB” I am not able to see the sequence container added programmatically, but it is visible in the Package explorer.
An idea on this? Is it something wrong in the code? Or need to add or refresh the containers?
Your inputs/suggestions are welcome. Thanks in advance!
Regards,
Umesh
import csv file use ssis why 04-2302 change to Apr-02
SQL Server 2012 virtual labs feature expired MS software .. and noone cares
I tried a SQL Server 2012 virtual lab this week to test out SSIS in 2012. It turns out the lab "features" expired MS software! So I tried another one of the 2012 labs ... same problem = fantastic!
So I emailed their support (which seems like it is an external company), via the support link on the site:
------------------- Original Message -------------------From: ________
Received: 7/4/2012 5:11 AM
To: CMG VLab Support; CMG VLab Support
Subject: Support Request from Micrsoft Virtual Labs Hyper-V Edition Site
<style><!-- .ExternalClass .ecxEmailQuote {margin-padding-border-} --></style>
Microsoft Virtual Labs Hyper-V Edition - Support Request from the website: cmg.vlabcenter.com
Name: ___
Email: ______@hotmail.com
Date Sent (GMT): 7/4/2012 5:11:36 AM
Date Sent (Pacific): 7/3/2012 10:11:36 PM
Lab Title: TechNet Virtual Lab Express: SQL Server 2012: Exploring SQL Server 2012 Integration Services
Module Id: e266f927-92c5-4249-b78a-6d67d8ca8013
Person Id: _________________________________
ActiveX Id: 00000000-0000-0000-0000-000000000000
User agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0)
Opening Page: Troubleshooting/FAQ
Problem Description: In the lab "Exploring SQL Server 2012 Integration Services", the instructions say "To open SQL Server Management Studio, click the Start button, and then select All Programs | Microsoft SQL Server 2012 RC0| SQL Server Management
Studio". I did this and all I get is a dialog box saying the following:
---------------------------
Microsoft SQL Server Management Studio
---------------------------
Evaluation period has expired. For information on how to upgrade your evaluation software please go tohttp://www.microsoft.com/sql/howtobuy
---------------------------
OK
---------------------------
It looks like I can't do the rest of the course without this?
What is worse is the response I eventually received back:
From: SeanStastny@exsilioinc.com
To: _______@hotmail.com
Subject: RE: Support Request from Micrsoft Virtual Labs Hyper-V Edition Site CRM:0014733
Date: Tue, 10 Jul 2012 23:57:55 +0000
Hello,
Unfortunately this lab is scheduled to be taken down; we currently have no time line for bringing it back up or replacing it. Sorry for the inconvenience.
Thanks,
Sean
Wow! Can you just feel the love in this response! "Scheduled"?? When? The labs are still there today - why keep these up there if they are not working?
"No time line for replacing it"?? This is the 2012 version not 2005 or 2000. Seriously?