Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 The buffer is insufficient

Author  Topic 

stathis30_2000
Starting Member

23 Posts

Posted - 2007-08-22 : 06:41:10
Hi all,

I have a strange problem that I need to solve as soon as possible.
I have created two CLR UDTs called point and point_list. Each record of a point_list consists of a list of points. I created a CLR stored procedure which reads some raw data and updates the point_list records.
When I execute the stored procedure the following error appears :

System.Data.SqlTypes.SqlTypeException: The buffer is insufficient. Read or write operation failed.
System.Data.SqlTypes.SqlTypeException:
at System.Data.SqlTypes.SqlBytes.Write(Int64 offset, Byte[] buffer, Int32 offsetInBuffer, Int32 count)
at System.Data.SqlTypes.StreamOnSqlBytes.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BinaryWriter.Write(Char ch) etc ...


Does anybody know what should I do ?
Thanks!

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-22 : 07:29:13
Without seeing your code for the CLR UDT? No idea but something is wrong with it.
Maybe you are receicing an 64-bit parameter but only has a 32-bit parameter in your code?




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

stathis30_2000
Starting Member

23 Posts

Posted - 2007-08-22 : 09:41:32
I think I found the cause .. I read that the max byte size that a UDT record can reach is 8000 bytes. Is that true ? Is there a way to change it ?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-22 : 10:26:09
VARCHAR(MAX) is now 2147483647 bytes.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

stathis30_2000
Starting Member

23 Posts

Posted - 2007-08-22 : 11:24:38
Thank you very much for your reply,

I am new to sql server and I need some more information on how to use varchar(max) instead of my udt. Should I replace my utd with varchar(MAX)? I have defined some methods for my udt like point_list.getDistance, how can I use these with varchar(MAX) ?

I appreciate your help
Go to Top of Page
   

- Advertisement -