SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 The buffer is insufficient
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

stathis30_2000
Starting Member

23 Posts

Posted - 08/22/2007 :  06:41:10  Show Profile  Reply with Quote
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

Sweden
30113 Posts

Posted - 08/22/2007 :  07:29:13  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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 - 08/22/2007 :  09:41:32  Show Profile  Reply with Quote
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

Sweden
30113 Posts

Posted - 08/22/2007 :  10:26:09  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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 - 08/22/2007 :  11:24:38  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000