Quantcast
Channel: SQL Server Integration Services forum
Viewing all 24688 articles
Browse latest View live

multiple flat flies create 1 zip file

$
0
0
I have a requirement where I will be receiving multiple flat files in a folder, I need to create 1 zip file and drop it into another folder. How can I achieve this using SSIS ?

MBH


Custom component using a CACHE Connection Manager

$
0
0

I'm writing a custom data flow transform where I want to make use of a Cache Connection Manager (a cache created from a Cache Transform).  I've successfully set up the design time to allow this to be selected.  What I can't figure out is what object to cast the InnerObject to in order to get something I can use.  I've done this successfully before with OLEDB connections.  For the CACHE, I have these lines of code in my AcquireConnections method (C#):

 

// Convert the native IDTSConnectionManager100 to the managed ConnectionManager.
ConnectionManager cm = Microsoft.SqlServer.Dts.Runtime.DtsConvert.GetWrapper(ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager);

// Retrieve the underlying Connection through the InnerObject.
ConnectionManagerCache cmCache = cm.InnerObject as ConnectionManagerCache;

That last line yields a null object.  I've seen that before if the cast selected for InnerObject is wrong.  In this case I've tried everything obvious and even tried AdoNet and OleDb casts.   All yield null.    If I breakpoint things I can see InnerObject defined as System.__ComObject.    Beyond that I can't seem to find any introspection techniques that will tell me how to cast that InnerObject value.  ConnectionManagerCache would seem to make the most sense ...

Any help much appreciated.

Two results from single Task SQL

$
0
0

Hi,

I have a table with email addresses and CC_Flag.

Email     | CC_Flag

xxxx           0

yyyy           1

zzzz           1

Using Task SQL, I am trying to pass these email addresses to two separate variables - To_field, Cc_field on basis of the CC_Flag

Is it possible to fill two variables from a single SQl Task, if so can you please help me on this !!

Error in Microsoft.SQLServer.Dts.Runtime.TaskHost : To run a SSIS package outside of SQL Server Data Tools you must install check if source file exists of Integration Services or higher

$
0
0

"Error in Microsoft.SQLServer.Dts.Runtime.TaskHost : To run a SSIS package outside of SQL Server Data Tools you must install check if source file exists of Integration Services or higher"

I'm getting this error while running an SSIS dtsx package using a console app in c#.

My SSIS package is built using SQL Data Tools 2012, contains script task (framekwork 4.5), the console app is built using 2012 &  framework 4.5.

The package has many variables; I didn't explicitly add those in console app code; as they are there in dtsx file itself.

The package consumes a csv file and writes record to SQL 2008 R2 database and creates an entry in MS CRM.

how to execute ssis package?

$
0
0

IS THERE ANY ANOTHER WAY TO EXECUTE A PACKAGE WITH OUT USING  SSISDB and sql  server agent?

can we execute package by using dtsconfig?

 

Execute Sql Task

$
0
0

Hi ,

Can  anyone please tell how we can use a stored procedure inside a execte sql task

I  have stored proc with one input parameter and the execute sql task I have declare the parameter .

I have geiven the below code in the execute sql task

exec  DATA_COMPARE ?

Data_comapre is my stored procedure name and I am getting syntax error . How we can call sp from execute sql task

Thanks

Jeeva

How do I add only new rows to a destination table (when copying a table from another database every night)

$
0
0

How do I add only new rows to a destination table (when copying a table from another database every night) ?

Every night I am copying a number of tables from one database to another.

I only want to insert news rows (that are not in the destination table, but are in the source table) to the destination table.

I might normally drop the destination table and just copy over the whole table, but in this case rows can be deleted from the source table, but I want to keep these old rows in the destination table (to maintain history). So I only want to add in rows to the destination table that have been added to the source table since last time.

I guess I could copy the whole of the source table to a temporary table in the warehouse, then use a T-SQL merge command to compare and just add new rows to the destination table- but suspect that this is not the best way.

SSIS packages with custome calendar.,

$
0
0

Hi,

I am working on one assignment, wherein SSIS project has multiple packages, each needs to run at different frequency ( monthly, weekly, daily).

At SQL SERVER Job, i would like to schedule single package and underneath that, multiple packages can run. Few should run daily, monthly and weekly basis, how should I design this use case to run multiple packages with custom calendar.

Thanks


Looping through Rowset variable with Foreach Loop task and execute sql task

$
0
0

Hi,

I would be very grateful if someone can please help me out,  this is my problem.

I have created a package and have done all my transformations and then loaded it into a staging table which is the No Match Output of a lookup because it does not have an ID column ,  what i have done so far is to use sql command in oledb source to pick out all the columns and include an ID column eg select *, ' ' as ID from table1 which i stored in a variable with a recordset destination task, i now used the ADO in foeach loop to map it to all the column according to their real positons in the Dbase,    what i want is to execute the stored proc below to  loop through each row at a time and inserting the returned output value into the ID COLUMN ,   ( the stored proc gets the last value from a table and keeps adding one incrementally) . I nitially stored the out value of the stored proc in a variable with execute sql task and want to use it in the derived column or expression editor but it will not allow me because its a system object variable.  i don't have to go this way if you have a better sugestion.  Thanks

Olu

CREATEPROCEDURE [dbo].[FTP_GetCounterXXXX] 

-- For a given CounterName, returns the next value. (Guaranteed unique)

@CounterName

varchar(30)='',

@LastValue

integerOUTPUT

AS

SET

BEGIN

TRANSACTION

if

notexists(select*from Counterxxxxwhere COUNTER_NAME=@CounterName)

insert Counterxxxx(COUNTER_NAME, LAST_VALUE)

values(@CounterName,0)

select

@LastValue=LAST_VALUE+1

from Counterxxxx(holdlock)

where COUNTER_NAME= @CounterName

update

CounterXXXX

set LAST_VALUE=@LastValue,

 LAST_UPDATED

=getdate(),

UPDATED_BY

=user_name()

from Counterxxxx

where COUNTER_NAME=@CounterName


biroma

Want to install Excel OLE DB provider Microsoft.ACE.OLEDB for 64-bit version of SSIS ? Please anybody suggest something

$
0
0

I have a SSIS package which takes the data from SQL server table and load into Excel sheet. The packages is working fine under 32-bit environment. But my requirement is to execute the same package under 64-bit. When i tried to do that i got an issue like"DTS_E_OLEDB_EXCEL_NOT_SUPPORTED: The Excel Connection Manager is not supported in the 64-bit version of SSIS, as no OLE DB provider is available"So later, i downloaded 64-bit Microsoft ACE.OLEDB provider and installed it on my server from thislink.

But It doesn't worked, the same issue was remain. Later I have installed the Data Connectivity Components from here.

Even though my issue still remain as same, Can any one tell me how to resolve this issue?


Venkat G


Get FileName fo each file created via Dynamic Flat File Destination.

$
0
0

Hi,

Am stuck on this, hope someone can help.

Need to know how I can get the dynamic filename created in the FlatFile destination for insert into a package audit table?

Scenario:

Have created a package that successfully outputs Dynamiclly named flat files { Format: C:\Test\’Comms_File_’ + ‘User::FileNumber’+’_’+Date +’.txt’ eg: Comms_File_1_20150724.txt, Comms_File_2_20150724.txt  etc} usingForeach Loop Container  :

* Enumerator Set to: “Foreach ADO Enumerator” with the ADO object source variable selected to identify how many total loop iterations there are i.e. Let’s say 4 thus 4 files to be created

*Variable Mappings : added the User::FileNumber – indicates which file number current loop iteration is i.e. 1,2,3,4

For the DataFlow task have a OLDBSource and a FlatFile Destination where Flat File ConnectionString is set up as:

@[User::Output_Path] + "\\Comms_File"+ @[User:: FileNumber] +"_" + replace((DT_WSTR, 10) (DT_DBDATE) GETDATE(),"-","")+ ".txt"

All this successfully creates these 4 files:

Comms_File_1_20150724.txt, Comms_File_2_20150724.txt, Comms_File_3_20150724.txt, Comms_File_4_20150724.txt

Now the QUESTION is how do I get these filenames as I need to insert them into a DB Audittable.

The audit table looks like this:

CREATE TABLE dbo.MMMAudit

  (

     AuditID      INT IDENTITY(1, 1) NOT NULL,

     PackageName     VARCHAR(100) NULL,

  FileName           VARCHAR(100) NULL,

     LoadTime        DATETIME NULL,

     NumberofRecords INT NULL

  ) 

To save the Filename & how many records in each file in our Audit Table, am usingan Execute SQL Task and configuring it as this:

  1. Execute SQL TaskParameter mapping - Mapped the User Variable (RecordsInserted) and System Variable( PackageName) to Insert statement as shown below

SQLStatement: INSERT INTO [dbo].[MMMAudit] ( PackageName,NumerofRecords,LoadTime)

                                                                               (?,?.GETDATE)

Again this all works terrific & populates the dbo.MMMAudit table as shown below BUT I also need to insert the respsctive file name – How do I do that? Thanks

AuditIDPackageName FileName  NumberOfRecords

1             MMM                NULL                      12

2         MMM               NULL               23

3         MMM               NULL              14

4         MMM               NULL               1                     

Issue using Excel Source while Reading Excel File in SSIS 2008

$
0
0

While fetching data from Excel File using Excel source in SSIS 2008  , it is showing the below error message

DataAccess mode =Table name or view name variable

Variable name = select the variable which store the excel file path.

 when clicking on the column to view the records it throws the below error.

Error Message 

"

TITLE: Microsoft Visual Studio
------------------------------

Error at Import User Provided Data To Staging Area [EX_SRC_InputFile [528]]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.

Error at Import User Provided Data To Staging Area [EX_SRC_InputFile [528]]: Opening a rowset for "E:\PTS_SSIS\ZPTS-Files\011111_DrawingImport2_2015-07-14_12-25-30.xlsx" failed. Check that the object exists in the database.



------------------------------
ADDITIONAL INFORMATION:

Exception from HRESULT: 0xC02020E8 (Microsoft.SqlServer.DTSPipelineWrap)

------------------------------
BUTTONS:

OK
------------------------------

"

how can we resolve the issue ..

How to populate the whole active directory information in a Table using Script Task in ssis 2008

$
0
0

We have table where we want to populate the fields from Active Directory using Script Task in ssis 2008 . Please suggest the code in c#


CREATE TABLE [ZPTSMGR].[ActiveDirectoryRaw](
[Id] [int] IDENTITY(1,1) NOT NULL,
[LoginName] [nvarchar](50) NULL,
[LastName] [nvarchar](100) NULL,
[MiddleName] [nvarchar](50) NULL,
[FirstName] [nvarchar](100) NULL,
[OfficePhone] [nvarchar](50) NULL,
[MobilePhone] [nvarchar](50) NULL,
[HomePhone] [nvarchar](50) NULL,
[Email] [nvarchar](50) NULL,
[Department] [nvarchar](50) NULL,
[InActiveDirectory] [bit] NULL,
 CONSTRAINT [PK_ActiveDirectoryRaw_Id] PRIMARY KEY CLUSTERED 
(
[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

How to declare multiple derived column in SSIS Derived column Task

$
0
0

Hi Everyone,

Can any please let me know how to declare multiple derived columns in SSIS Derived Column Task in one attempt.

as i have around 150 columns coming from Flat file. I had created the required Expression in Excel and now i want add those in derived column task but its allowing only 1 expression at a time.


Regards

NIkhil C

Excel Reading in SSIS Script Task

$
0
0

Hi All,

I used the below code to read excel files  in SSIS 2008R2 script component and it is working fine but when i copied it in Script Task of SSIS 2012, the code doesnt work. I have define one variable

Var_ExcelFileName and stored location of excel file.

/* Microsoft SQL Server Integration Services Script Component
*  Write scripts using Microsoft Visual C# 2008.
*  ScriptMain is the entry point class of the script.*/

using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using SC_3168ce5630934578a9b0a226b5541ee4.csproj;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Collections.Generic;

[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
    DataTable dt;

    public override void PreExecute()
    {
        base.PreExecute();
    }

    public override void PostExecute()
    {
        base.PostExecute();
    }

    public override void CreateNewOutputRows()
    {
        try
        {
            dt = LoadWorkbook(Variables.VarExcelFileName, "Sheet1");

        }

        catch (Exception ex)
        {
            //throw ex;
            //  MessageBox.Show(ex.ToString());
        }

    }


    public static DataTable LoadWorkbook(string FileName, string SheetName)
    {

        string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FileName + ";Extended Properties=\"Excel 12.0;HDR=No;IMEX=1\"";

        OleDbConnection oledbConn = new OleDbConnection(connString);
        try
        {

            DataSet ds = new DataSet();

            oledbConn.Open();

            DataTable objSheetNames = oledbConn.GetSchema("Tables");
            OleDbCommand cmd;

            if (SheetName == null && objSheetNames.Rows.Count > 0)
            {

                cmd = new OleDbCommand("SELECT * FROM [" + objSheetNames.Rows[0][2].ToString() + "]", oledbConn);
            }
            else
            {
                cmd = new OleDbCommand("SELECT * FROM [" + SheetName + "$]", oledbConn);
            }


            OleDbDataAdapter oleda = new OleDbDataAdapter();

            oleda.SelectCommand = cmd;


            oleda.Fill(ds, "LabOrder");

            return ds.Tables[0];

        }
        finally
        {
            // Close connection
            oledbConn.Close();
        }
    }





}

 I am getting errors in the below lines:

using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;

And Also in this line:

dt = LoadWorkbook(Variables.VarExcelFileName,

"Sheet1");


Misaligned data while exporting .csv file using SSIS

$
0
0
I've very simple task to create .csv file on SSIS.  File has been createdbut theis misaligned so how i can fix that issue?


SSIS 2012 (11) Flat file import with footer hangs (never completes)

$
0
0

Hi all,

We have many SSIS packages built in Visual Studio 2008 and previously deployed to SQL 2008 (SSIS 10) and then migrated to SQL 2012 (SSIS 11).

Most packages work OK but a couple hang and never complete.  These import text files with a footer which has a different number of columns to the data rows.  We have found that SSIS 10 allowed this OK and the footer row was filtered out once in SSIS.

Every bit of documentation states that in SSIS 11 (SQL 2012) the flat file import has been improved but as far as we can see it means that some of our imports do not work.  The data looks like this:

10;  234234;SMITH;2015-01-07;  3123123123;VE65          
10;  234234;SMITH;2015-01-07;  3123123123;VE65
10;  234234;SMITH;2015-01-07;  3123123123;VE65
99;000277;000000                                                                                                   

You can see the footer has a different number of columns.  In SSIS 11 (SQL 2012) it starts to process the file and never completes, the SSIS package runs continuously and does not complete, I have to stop it.

I can find no other references to this on the internet, I really do not want to pre-process the file or use a custom script as a data source for the import because there should be a way to handle this - it must surely be a bug if it hangs?

Is there a update I need to do to fix this?

Regards,

Gary.

Dimension Table updates

$
0
0

Hello,

So I'm creating a package and I want to constantly update my dimension tables when new user information is given. The dimension table I am using is Dimension User including their first name, last name, full name and email ID. Now their is a small glitch from the data I am pulling. When I pull the data from the source the first name includes the first name and last name and all the other data is fine. So before loading it back into the OLE DB Destination I did a "copy's columns" transformation so that the first name column is copied into the full name column. Now when I put a data viewer right after the "copy column" transformation it shows everything correctly, first name is the full name, last name is last name and full name is same as first name.
However the output displayed once it enters back into the DIM user is "unknown" for both first name and full name.
"Unknown" was a condition I had put into original script if their is a NULL term. But there isn't a NULL term because last name and email ID columns are populated
So where is the problem being caused?

SQL extract

$
0
0

Sorry I just need to vent.  Why does it take me 4 hours to set up an SSIS package that I can run from a SQL job to extract data from a SQL database to and Excel workbook.  Shouldn't this be easy to do with 2 Microsoft products?  Writing the query to extract the data takes 10 minutes, the rest of this process should take less than that. 

I should be able to create a new job that runs my query (I can actually do that) and saves the data to an Excel workbook.  Why can't I do that?

Failed to open fast load for # temp table

$
0
0

Hi,

I have a SSIS package to import data from a file into my SQL Server database. First I load the data into a # temp table and do some validations and then move the data to a permanent table in my database. Recently the package has been failing intermittently with the error

SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E37.
An OLE DB record is available.  Source: "Microsoft OLE DB Provider for SQL Server"  Hresult: 0x80040E37  Description: "Invalid object name '#temp_ssis_detail'.".

Failed to open a fastload rowset for "#temp_ssis_detail". Check that the object exists in the database.

In the step before I load the data into this table, i check if the temp table exists, if not the table is created. But the data load step still fails with the above error. I have these settings in my package.

1) For data connection manager - Retain same connection is set to True

2) Data Flow task - Delay Validation is set to True

3) OLEDB Destination Task inside Data Flow task using the Temp Table - ValidateExternalMetadata is set to false.

4) I am just using one data connection.

5) before using the temp file I am checking if it does not exist I will create it.

The reason I am using the temp table approach (vs normal table) is because the data I import into has sensitive data and I do not want to have it in clear text in the database even for a few minutes.

How can I prevent the temp table issue? Or is it possible to load data in encrypted format to a normal database table? I use symmetric keys and certificates on SQL Server to do encryption and decryption.

Thanks,

Sandeep


Viewing all 24688 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>