Author |
Topic |
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-02-15 : 09:01:21
|
someone recently told me that their bcp export of a table with over MAX_INT rows failed because BCP hit an overflow in the internal counter that bcp uses to tell you how many rows it's exported. You know how it write "rows copied to host file: 40000" to stdout? That number got to MAX_INT, then went negative, then BCP crashed. So they had to start all over and break things up with the -F, -L flags.I was rather surprised that a program that claims to handle "bulk" data would use a 32 bit int to accumulate the count. I suppose the original sybase dev figured nobody would ever want to export more than 2b rows.just wondering, has anyone seen this before? I am about to kick off a similar large export and am planning to break it up so as not to hit this, but that also means I won't be able to verify that it is indeed a problem.  elsasoft.org |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2008-02-15 : 09:20:19
|
do you have the (disk/time) capacity to create a 'narrow' table with small length columns....and fill same with 2b+ rows? then you can do a home-grown test on the cheap ??? |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-02-15 : 09:32:04
|
perhaps I'll do that. I already have such a table built so I could just export one bit column from it and see what happens. If I do, i'll report back with the result. elsasoft.org |
 |
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-02-15 : 14:05:51
|
Works for me.1000 rows successfully bulk-copied to host-file. Total received: 10000110001000 rows successfully bulk-copied to host-file. Total received: 10000120001000 rows successfully bulk-copied to host-file. Total received: 10000130001000 rows successfully bulk-copied to host-file. Total received: 10000140001000014129 rows copied.Network packet size (bytes): 4096Clock Time (ms.): total 3105521"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-02-15 : 14:11:36
|
quote: Originally posted by jhocutt Works for me.1000 rows successfully bulk-copied to host-file. Total received: 10000110001000 rows successfully bulk-copied to host-file. Total received: 10000120001000 rows successfully bulk-copied to host-file. Total received: 10000130001000 rows successfully bulk-copied to host-file. Total received: 10000140001000014129 rows copied.Network packet size (bytes): 4096Clock Time (ms.): total 3105521"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking
that's not MAX_INT. max is 2147483647. so you'd need to export at least 2147483648 rows to overflow. elsasoft.org |
 |
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-02-15 : 14:20:40
|
Duh, sorryfor some reason, I just went with a billionLet me try that again"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-02-15 : 15:57:03
|
sure enough, it does indeed fail. took me 6 hours to export this many rows of bit columns in native format. 1000 rows successfully bulk-copied to host-file. Total received: 21474800001000 rows successfully bulk-copied to host-file. Total received: 21474810001000 rows successfully bulk-copied to host-file. Total received: 21474820001000 rows successfully bulk-copied to host-file. Total received: 21474830001000 rows successfully bulk-copied to host-file. Total received: -2147483296SQLState = HY000, NativeError = 0Error = [Microsoft][SQL Native Client]Table contains less rows than first row countBCP copy out failed elsasoft.org |
 |
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-02-15 : 15:58:32
|
:( You beat me, Mine just finished."God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-02-15 : 17:36:37
|
ok i got to ask... billion rows? what are you saving in there??_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-02-15 : 19:29:54
|
ahh... you're using the short scale version of the billion (10^9 = 1,000,000,000)over the pond we use the large scale one (10^12 = 1,000,000,000,000)_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-02-15 : 20:59:32
|
ah. i hope never to have to go that far. the largest table I have to work with is 8 * 10^9 rows. elsasoft.org |
 |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2008-02-18 : 11:43:15
|
Aha....maybe you should now feature on "Mythbusters" |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-02-18 : 11:54:30
|
why? what's the myth? elsasoft.org |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-02-18 : 11:59:21
|
Have you tried using DTS or SSIS?CODO ERGO SUM |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-02-18 : 12:10:14
|
quote: Originally posted by Michael Valentine Jones Have you tried using DTS or SSIS?CODO ERGO SUM
no, and i don't plan to.  elsasoft.org |
 |
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-02-19 : 15:14:53
|
I got bored.DTS on SQL 2000 stopped at 2,147,483,000. I tried to export 3,000,042,387so while it does not crash, it also does not give a warning that it did not complete. :("God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-02-19 : 15:20:22
|
So, is there a 64-bit version of BCP or DTS that uses a bigint counter ?CODO ERGO SUM |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-02-19 : 16:30:02
|
no idea. it's a rare enough case that one needs to export that many rows anyway. I will break it up from now on just to be safe. bcp is an excellent tool that I use every day. i can forgive it this little flaw.  elsasoft.org |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-02-19 : 16:45:40
|
Did anyone try this with SSIS? Maybe it can do this without an overflow.CODO ERGO SUM |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
|
Next Page
|