Monday, June 1, 2015

[Errors] Fixing "Buffer provided to read column value is too small" on a 2008 box.

Recently had a problem with my Eventlog Capture code.  An odd error mentioned in SQL 2005 - but this is on a 2008 box.


Error: 682, Severity: 22, State: 148. 2015-06-01 02:10:10.14 spid71 Internal error. Buffer provided to read column value is too small. Run DBCC CHECKDB to check for any corruption.

WHAT?  OMGCORRupti....oh, wait. DBCC comes back clean.  Go through code. Narrow it down to the insert.  Which actually inserts into a view.  And the definition of the view had changed in two ways. 

Why'd it kick in today and not before?  New month - so the monthly table was now getting inserts through the view, causing failures.  

Not sure which change caused the problem, but changing the fields in each table to match (I'd made "strings" and "Message" longer), and changing the view from:


select a,b,c,d,e from table201504
union all
select a,b,c,d,e from table201505
union all
select * from table201506

to

select a,b,c,d,e from table201504
union all
select a,b,c,d,e from table201505
union all
select a,b,c,d,e from table201506


fixed it. *Phew*

No comments: