SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Really Strange


Really Strange

Author
Message
AndrewSQLDBA
AndrewSQLDBA
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1824 Visits: 3427
Hello Everyone
I hope that your day has been better than mine.

I have been working most of the day with a SSIS Package that is giving me a really strange effect.

I will keep this really simple.

I have two tables, the SSIS package is filling table1 from a flat text file source. Table2 is being filled with the data from Table1 using an Execute SQL Step, in which I call a stored procedure. Both tables have the same columns.

When I execute the package, the data from the text file is loaded into Table1, and then the next step is calling the sproc to load the data into Table2. Which it does, but there are a large number of different rows in table1 than are in Table2. Different every time, but approx 16000 rows are inserted into Table1, which is the exact number in the text file. But there are approx 14,000 up too 15,500 rows that are inserted into Table2. The query is a simple. This is a straight data insert from one table to another.

INSERT INTO dbo.Table2
SELECT
Column1
, Column2
, Column3
, Column4
, Column5

FROM dbo.Table1



I have no idea what is causing some rows to not be inserted. Oh, I created the tables using the same script, changing only the name for each table.

I have tried this same package on multiple servers, picking up the same text file(s). There are different files per day. I have take some that are waiting to be processed, but were created up too a couple weeks ago. I have created multiple packages, one package exactly the one that is running, and others with only a couple steps in them. Just enough to pump the data from one table to another.

I have never seen anything like this before. I am hoping that someone has some advice, or a suggestion as to what to look for that may be causing this rather odd insert.

Thanks You in advance for all your assistance, suggestions and advice.

Andrew SQLDBA
Want a cool Sig
Want a cool Sig
SSC-Addicted
SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)

Group: General Forum Members
Points: 420 Visits: 705
Sounds like the data in the file isn't completely loaded into table1 before you start the insert into table2, maybe getting dirty reads... what isolation level? I'm going to assume that table1 is a staging table and table2 is the prod table? If not why not just use multicast task to load both table at the same time from the source file...
maybe explicitly start a transaction around the first task of loading table1 or put a pause between loading table1 to inserting table2...

---------------------------------------------------------------
Mike Hahn - MCSomething someday:-)
Right way to ask for help!!
http://www.sqlservercentral.com/articles/Best+Practices/61537/
I post so I can see my avatar Hehe
I want a personal webpage Cool
I want to win the lotto :-D
I want a gf like Tiffa w00t Oh wait I'm married!:-D
AndrewSQLDBA
AndrewSQLDBA
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1824 Visits: 3427
I think that I forgot to mention this.

I can write a query of the same thing that is in the sproc, and it works fine, inserts all rows.

This is driving me insane at this point.

Anyone else have any suggestions?

Thanks
Andrew SQLDBA
Jason-299789
Jason-299789
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2129 Visits: 3232
Can you post the code in the SP, as that might help us see what's going on.

I take it you've don't a count on the source table and that matches the number of rows in the text file.

_________________________________________________________________________
SSC Guide to Posting and Best Practices
wolfkillj
wolfkillj
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1480 Visits: 2582
AndrewSQLDBA (2/18/2013)
Hello Everyone
I hope that your day has been better than mine.

I have been working most of the day with a SSIS Package that is giving me a really strange effect.

I will keep this really simple.

I have two tables, the SSIS package is filling table1 from a flat text file source. Table2 is being filled with the data from Table1 using an Execute SQL Step, in which I call a stored procedure. Both tables have the same columns.

When I execute the package, the data from the text file is loaded into Table1, and then the next step is calling the sproc to load the data into Table2. Which it does, but there are a large number of different rows in table1 than are in Table2. Different every time, but approx 16000 rows are inserted into Table1, which is the exact number in the text file. But there are approx 14,000 up too 15,500 rows that are inserted into Table2. The query is a simple. This is a straight data insert from one table to another.


INSERT INTO dbo.Table2
SELECT
Column1
, Column2
, Column3
, Column4
, Column5

FROM dbo.Table1



I have no idea what is causing some rows to not be inserted. Oh, I created the tables using the same script, changing only the name for each table.

I have tried this same package on multiple servers, picking up the same text file(s). There are different files per day. I have take some that are waiting to be processed, but were created up too a couple weeks ago. I have created multiple packages, one package exactly the one that is running, and others with only a couple steps in them. Just enough to pump the data from one table to another.

I have never seen anything like this before. I am hoping that someone has some advice, or a suggestion as to what to look for that may be causing this rather odd insert.

Thanks You in advance for all your assistance, suggestions and advice.

Andrew SQLDBA


Have you adjusted the "Rows Per Batch" or "Maximum Insert Commit Size" properties of your Destination connection? If so, SSIS is sending the data to SQL Server in chunks that SQL Server handles as separate transactions. If your package sends 10 batches of rows to SQL Server then executes the stored procedure, SQL Server may have only completed and committed 8 or 9 of those batch transactions when the stored procedure begins to read data from that table. Isolation ensures that the stored procedure will only see rows that are committed when it begins its SELECT (unless you've tinkered with isolation levels or used hints like NOLOCK). That may explain why you get varying numbers of rows in the second table each time you run the package.

Jason Wolfkill
Blog: SQLSouth
Twitter: @SQLSouth
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search