I know this is more of a hardware forum, but I was hoping to get some SQL help. I figure some of the regulars here would be familiar with SQL. It's a bizarre problem that I wouldn't even know how to properly google.
I have a temp table that I'm inserting rows into. If I perform the following script:
insert into #TempTable
select * from TableA
...I get a "String or binary data would be truncated" error. Ok, that's fine. I guess somewhere in the data there's probably a string value too large. So I checked the string fields and I'm pretty sure there are none that are too large. I verify this with some text length queries on the string columns.
So just to make sure there isn't something I miss, I attempt to insert just the top 100 records. If that works, the top 200. I figure I'll narrow down to the record that has bad data in it. And that's when I come upon something that's totally baffling.
There are 409 records in TableA. If I do this script, it works:
insert into #TempTable
select top 500* from TableA
Yet, if I do this script, it fails:
insert into #TempTable
select * from TableA
wtf? Anyone seen this before?
After some more testing, I find that the script fails when I select the top 507 rows, but it works if I select the top 506 rows. And yet, the actual row count is still only 409! So I don't even know where to begin with this.
Edit: I guess I should mention I'm working in MS SQL 2008
Edited, Nov 2nd 2010 11:59am by enigmaticcam