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

Bulk Insert fails with the error "Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 4 (ContactID).".

$
0
0

Bulk Insert fails with the error '"Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 4 (ContactID)'

Destination table structure as below

CREATE TABLE DataCheck
(
FirstName VARCHAR(50),
MiddleName VARCHAR(50),
LastName VARCHAR(50),
ContactID INT
)

Sample data in the flat file

FirstName,MiddleName,LastName,ContactID
a,b,a,1
a,s,e,2
d,s,w,3
g,s,e,4

Following settings i have done using bulk insert task

In connection below options are used for bulk insert

Destination table :DataCheck

RowDelimiter:{CR}{LF}

ColumnDelimiter:Comma(,)

FileConnection:DataCheck.txt

When i run the bulk insert task all the four rows are inserted but task fails with the error error message

'"Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 4 (ContactID)'

Very strange behavior.I prefer to work with Execute SQL task or some other means for bulk insertion of data.I was just having checking

Any particular reason for this failure and how it can be fixed


Smash126



how to copy data from two tables into one falt file

$
0
0

Hi,

i have two tables with some data and i want them to copy into flat file based on below condition

if in first table year=2010 then it should search in 2nd table and display data present in that table in flat file,

likewise for 2011

can any one suggest me how can i do it


How to Overwrite an Excel sheet using SSIS or How to Delete data Before Inserting into Excel Sheet

$
0
0

Hi all,

i facing a problem with Excel Sheet, when i running SSIS package at that time it appending the data to already existing data .but i want to overwrite the data or delete the data and reinsert the data into excel sheet.

and i tried Drop table Excelsheet; and agian using another execute sql task creating Excelsheet but it not working :( .

so please share your answer here .

thank u all :) 

Extracting data from sharepoint using Script in SSIS 2005

$
0
0
Can sharepoint lists be accessed using ODATA in SSIS 2005. Or using web services the only option when getting SharePoint lists data is SSIS 2005 through script task.

how to update SSIS Variable programmatically?

$
0
0

Hi,

  I want to update 2 variables inside the SSIS Package 2008 R2 using asp.net.  this article: http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.dtscontainer.variables.aspx teaches how to create the variable but i want to update it not create it. is there any easy way to do that?

thank you

SSIS Error: [Execute SQL Task] Error: Executing the query "exec ?=Authors_insert ?" failed with the following error: "Value does not fall within the expected range.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctl

$
0
0

Hi All.

When i try to execute the below query in SQL Execute Task:

exec ?=Authors_insert ? , from here i call the stored procedure named Authors_insert as given below:

alter procedure Authors_Insert
(
@FirstName Varchar(20)
)
as
insert into Authors (FirstName) values (@FirstName)

Please find below the screenshots of my SQL Execute Task:

I am getting the below mentioned error message:

SSIS Error: [Execute SQL Task] Error: Executing the query "exec ?=Authors_insert ?" failed with the following error: "Value does not fall within the expected range.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly.


Ramasubramanian S

how to find number of sundays and saturdays between two given dates in ssis ?

$
0
0

How to find number of sundays and saturdays between two given dates..?

i have an excell file, having two date columns and i want to know number of working days between that two days.

what ll be the expresson in SSIS  derived column.

Please suggest me...


Thanks & Regards $@m

Description: "Violation of PRIMARY KEY constraint

$
0
0

Hi all i have a scheduled job that runs every morning and this package has many containers and this morning the job failed with the following error:

Message

Executed as user: AD\MOSS_IBI. ...9.00.3042.00 for 64-bit  Copyright (C) Microsoft Corp 1984-2005. All rights reserved.    Started:  2:00:02 AM  Error: 2012-08-13 02:24:15.58     Code: 0xC0202009     Source: Import CITATIONS Facts OLE DB Destination [423]     Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.  An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80004005  Description: "The statement has been terminated.".  An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80004005  Description: "Violation of PRIMARY KEY constraint 'PK_FACT_CitationDetails'. Cannot insert duplicate key in object 'dbo.FACT_CitationDetails'.".  End Error  Error: 2012-08-13 02:24:15.58     Code: 0xC0047022     Source: Import CITATIONS Facts DTS.Pipeline     Description: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "OLE DB Desti...  The package execution fa...  The step failed.

Wheni executed the CONTANIER manually it ran fine with no errors, why am i getting this when its run as a scheduled job, there are no changes to that package or container.

Thanks


error in SSIS script component

$
0
0

Hello,

I'm using SQL sder er 2008 Standard/

 

I am trying to use a script component to do a lookup, but when I execute the package (in debugging mode), In get an error screen.

Part of the error description is in Dutch, but it says "Object reference not set to an instance of an object "

More detailed, from the debug output screen:

Error: 0xC0047062 at Data Flow Task, Script Component 1 [1518]: System.NullReferenceException: Object reference not set to an instance of an object .

at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)

at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()

at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper100 wrapper)

Error: 0xC004701A at Data Flow Task, SSIS.Pipeline: component "Script Component 1" (1518) failed the pre-execute phase and returned error code 0x80004003.

 

This is the script:

using System;

using System.Data;

using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

using Microsoft.SqlServer.Dts.Runtime.Wrapper;

using System.Data.SqlClient;

using System.Collections.Generic;

public struct RangeItem : IComparable<RangeItem>, IComparable<DateTime>

{

    public Int32 Key;

    public Int32 Value;

    public RangeItem(Int32 key, Int32 value)

    {

        Key = key;

        Value = value;

    }

    #region IComparable Members

    public int CompareTo(RangeItem other)

    {

        return Key.CompareTo(other.Key);

    }

    public int CompareTo(DateTime other)

    {

        return Key.CompareTo(other);

    }

    #endregion

}

[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]

public class ScriptMain : UserComponent

{

    // Variables

    SqlConnection connection = null;

    Dictionary<String, List<RangeItem>> Cache = new Dictionary<String, List<RangeItem>>();

    const string query = "select WerkID, MedewerkerID, Werk_eind_KEY from DimMedewerker";

    public override void PreExecute()

    {

        base.PreExecute();

        connection = (SqlConnection)this.Connections.Connection.AcquireConnection(null);

        if (this.Variables.PreCache)

        {

            FillCache();

        }

    }

    private void FillCache()

    {

        FillCache(null);

    }

    private List<RangeItem> FillCache(string key)

    {

        string sql = query;

        if (!string.IsNullOrEmpty(key))

        {

            sql += string.Format(" where MedewerkerID = '{0}'", key);

        }

        sql += " Order By MedewerkerID, Werk_eind_KEY";

        SqlCommand command = new SqlCommand(sql, connection);

        SqlDataReader reader = command.ExecuteReader();

        List<RangeItem> times = null;

        try

        {

            Int32 lastKey = 0;

            Int32 endKey = 0;

            while (reader.Read())

            {

                Int32 WerkID = reader.GetInt32(0);

                Int32 MedewerkerID = reader.GetInt32(1);

                Int32 Werk_eind_KEY;

                if (reader.IsDBNull(2))

                {

                    Werk_eind_KEY = Int32.MaxValue;

                }

                else

                {

                    Werk_eind_KEY = reader.GetInt32(2);

                }

               

                if (lastKey != MedewerkerID)

                {

                    if (!string.IsNullOrEmpty(Convert.ToString(lastKey)))

                    {

                        // cache everything up until now

                        times.Add(new RangeItem(Int32.MaxValue, endKey));

                        Cache.Add(Convert.ToString(lastKey), times);

                    }

                    lastKey = MedewerkerID;

                    times = new List<RangeItem>();

                }

                if (Werk_eind_KEY < Int32.MaxValue)

                {

                    times.Add(new RangeItem(Werk_eind_KEY, WerkID));

                }

                else

                {

                    endKey = WerkID;

                }

            }

            times.Add(new RangeItem(Int32.MaxValue, endKey));

            if (!string.IsNullOrEmpty(Convert.ToString(lastKey)) && times != null && times.Count > 0)

            {

                try

                {

                    Cache.Add(Convert.ToString(lastKey), times);

                }

                catch (Exception e)

                {

                    throw new Exception(lastKey + " " + times[0].Key + " " + times[0].Value, e);

                }

            }

        }

        finally

        {

            reader.Close();

        }

        return times;

    }

    public override void PostExecute()

    {

        base.PostExecute();

    }

    public override void Input0_ProcessInputRow(Input0Buffer Row)

    {

        Int32 MedewerkerID = Row.MedewerkerID;

        List<RangeItem> ranges = null;

        if (!Cache.TryGetValue(Convert.ToString(MedewerkerID), out ranges))

        {

            // We don't have this value yet

            ranges = FillCache(Convert.ToString(MedewerkerID));

        }

       

        if (ranges == null)

        {

            throw new Exception("Couldn't find value for MedewerkerID " + MedewerkerID);

        }

       

        int index = 0;

        if (ranges.Count > 1)

        {

            index = ranges.BinarySearch(new RangeItem(Row.ZiekDagKEY, 0));

            if (index < 0)

            {

                index = ~index;

            }

        }

        try

        {

            Row.WerkID = ranges[index].Value;

        }

        catch (Exception e)

        {

            throw new Exception(string.Format("size: {0} index: {1} key: {2}", ranges.Count, index, Row.MedewerkerID), e);

        }

    }

}

 

What am I doing wrong?

 

Regards, Hennie

Table to CSV

$
0
0

Hi,

I am taking Source as table and destination as text file CSV.

In the table i have data like 0.00 and when i am trying to load into destination file i wan the data look like $0.00.

So i ahve added derived column and appended $ sign, but while loading data into text file i am as $0 instead of $0.00.

I have used currency and numeric data types with precision 2, but it did not work.

Please help me what kind of data type needs to used.

SQL 2008 Database extract works SSIS job created from it fails repeating the same extract

$
0
0

Using SQL 2008 r2 I successfuly extracted table data and wrote it to an Access database.  At the same time I created a SSIS job to automate the process.  The first step following the extract in both cases was to delete the Access table entries so the load would be fresh each time...  again the extract worked... but when the SSIS job is created and run,  it completes without error and the Access table has been emptied but no data was loaded.  any suggestions?  This has me baffled.

I just tried running the SSIS package without using a SQL job and the result showed the potential problem  just before deleting the Access table successfuly it gets this message twice:

"Warning Multiple-step OLE DB operation generated errors.  Check each OLE DB status value, if available.  No work was done."

I'm looking for the OLE DB status now.

Help for converting string to datetime in derived column

$
0
0

Hi,

When we convert string'1900-01-02' to datetime in derived column using function DT_Date. as well as Dt_dbdate and Dt_dbtimestamp

but got result as 1899-12-30 ,can anyone help me to solve this??

Regards

Jon

delete empty flatfiles after loading into share

$
0
0

Hi Gurus,

I loaded multiple flat files for file name coming in from Dataset. So, now for any file if there are zero rows or empty I want to dellete those files.

How can I do that with out .Net code.

Please help me with this.

VBA and SSIS

$
0
0

Hi all,

I have created an SSIS package on our file system. I can't export it to SQL as I haven't got the rights.

I would like to run the package from the file system via an excel Macro. Can it be done?

Thanks


Sql server ssis issue

$
0
0

Hi There,

I have created a package. Which is used to export data from one server to another server(Sqlserver).

I am getting the problem when we export the data using ssis package skip some columns to populate on the destination,but when we ran the same package second time then it populate the whole data for these columns.

Can you please suggest me how i will take this problem in ssis.


Rgds:-
Shaun 


Replicating a Oracle database on Sql Server

$
0
0

hello all!

i have to "replicate" a oracle database to a Sql server instance for a specif task... upper managment kind of request...

the thing is... i can move the data with a DataFlow task... any ideas on how can i replicate the tables??? the database has 855 tables... and i dont want to recriate them manually...

No Longer Want Environment Variables

$
0
0

I was using Environment Variables in my Parent-Child packages. I removed them and replaced them with references to a .dtsconfig file. However, when I try to run the parent package I get the below. Is something cached somewhere? Can I locate this reference?

Information: 0x40016038 at ReloadEquip: The package is attempting to configure from the environment variable "SSIS_CONFIG_ODS".


Please Vote &/or "Mark As Answer" if this post is helpful to you. Thanks and happy coding :D

Doubts

$
0
0

hi

in sql server2005

i am using query in 1st method

(insert into <destinationtable>(no,name)

select a.no,a.name from <sourcetable> a left outer join <destination table> b on a.no=b.no where b.no is null)

2nd method

(insert into <destinationtable>(no,name)

select * from <sourcetable> except <destination table>

Both methods are executing Please tell me which method is executing fast and good performance method tell me reasons..

Thanks

Ram

Using Excel Destinantion

$
0
0

Hi,

I am creating Excel table using Sql Task and then trying to populate data into that  table.

I am facing problem in executing the package. I can able to execute each task separately  but no the whole package. Please help me

DB2OLEDB table source hung, SSIS 2008 package neither succeeded nor failed

$
0
0

We have several SSIS packages that pull data from an outside DB2 database by way of a DB2OLEDB driver (version 2).  This particular SSIS package pulls data from 5 different DB2 tables to SQL Server, at which point the SQL staging table gets truncated and repopulated with the latest days' data.

There was a problem with this package over the weekend, but it wasn't a package or Job failure: the package itself never completed, it just ran and ran.  Monday morning, one of the IT guys noticed it still running (nearly 48 hours into it) and aborted it.  During investigation, we found that 4 of the DB2 tables' contents had been copied over successfully to our staging tables by the SSIS package, but one of the tables didn't get a single row copied over.  It's a case of "DB2OLEDB driver hung in the middle of a data transfer and the SSIS package didn't know what to do," I suppose.

Has anyone ever experienced or heard of this error?  And either way, I'm looking for suggestions on how to resolve such an error if it occurs again in the future.  (The problem with the SSIS package neither completing successfully nor failing altogether is that the Job did not generate the job failure email alert, and we waited until Monday morning to find out manually.  Needless to say, the managers are not happy.)

It appears I have a couple of options:

  1. Find out how long the SSIS package normally takes to execute successfully, then set the DB2OLEDB connection manager's "Connect Timeout" property to some value just over that amount so that the connection itself will timeout, causing an SSIS package failure;
  2. Create a separate SSIS package that uses sp_help_jobactivity to check and see if that DB2-accessing package is running and if so how long it's been running.  If it's been longer than expected, execute sp_stop_job;

Important to note that we didn't receive an error.  Fact is, we have no idea what was going on with the DB2 source table when this, er, "non-error" took place.

Any advice would be appreciated, whether it be "how to handle in the future" or "here is what likely happened."

Thanks,
Eric

Viewing all 24688 articles
Browse latest View live


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