Thursday, October 23, 2014

Store > 8 KB image as byte array in SQL Server 2008


I use NHibernate.



I do not think the error is in the code though, as when I connect the program to MySQL DB, this issue do not occur.



Just because nHibernate has it right with MySQL, does not mean that it has it right with SQL Server.


If you insist on delegating producing the SQL code to some other layer (not recommended), you will have to use Profiler see what nHibernate sends to SQL Server.


Also run


SELECT datalength(imagecol), COUNT(*) FROM tbl GROUP BY imagecol


This will give you an indication if truncation occurs when storing the data or on retrieval.





Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

No comments:

Post a Comment