Home All Groups Group Topic Archive Search About

one more byte added when writing blob

Author
7 Nov 2005 9:14 AM
DHuang
Use SQL Server 2K, C# in .NET 2.0.

When writing blob to an image column with in  chunks, why is there one more
byte added to the data? For example, an image of 29,592 bytes was written to
the database but when reading it back, it had 29,593 bytes and the last byte
was null.

The column was initialized with null value.

This is not the reading issue. When writing data with an insertion or update
statement (i.e. writing just once), no such problem occurs.

Does anyone  have ideas of why? Thanks.

Author
7 Nov 2005 7:38 AM
DHuang
I am wrong with the previous post. Ignore that please.

I fixed my problem already. When a row was inserted, a value of null was set
to the image column so that a valid pointer can be retrieved later for
inserting the real data in. When executing updatetext for inserting the data,
no data (even the null) was deleted. That is the problem and it should be
deleted.
Show quote
"DHuang" wrote:

> As stated in "UPDATETEXT" stored procedure, "A value of NULL appends the new
> data to the existing data value."
>
> This is a big annoying issue.
>
> "DHuang" wrote:
>
> > Use SQL Server 2K, C# in .NET 2.0.
> >
> > When writing blob to an image column with in  chunks, why is there one more
> > byte added to the data? For example, an image of 29,592 bytes was written to
> > the database but when reading it back, it had 29,593 bytes and the last byte
> > was null.
> >
> > The column was initialized with null value.
> >
> > This is not the reading issue. When writing data with an insertion or update
> > statement (i.e. writing just once), no such problem occurs.
> >
> > Does anyone  have ideas of why? Thanks.
Author
7 Nov 2005 7:38 AM
DHuang
As stated in "UPDATETEXT" stored procedure, "A value of NULL appends the new
data to the existing data value."

This is a big annoying issue.

Show quote
"DHuang" wrote:

> Use SQL Server 2K, C# in .NET 2.0.
>
> When writing blob to an image column with in  chunks, why is there one more
> byte added to the data? For example, an image of 29,592 bytes was written to
> the database but when reading it back, it had 29,593 bytes and the last byte
> was null.
>
> The column was initialized with null value.
>
> This is not the reading issue. When writing data with an insertion or update
> statement (i.e. writing just once), no such problem occurs.
>
> Does anyone  have ideas of why? Thanks.

AddThis Social Bookmark Button