|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Maximum Size for UDTHi,
I want to use UserDefined format for my CLR UDT and I need a formula to calculate its MaxSize. Thanks in advance, Leila "Leila" <Lei***@hotpop.com> wrote in There is as such, no formula. A UDT can not be bigger than 8k, so thenews:eVTHivsHGHA.2300@TK2MSFTNGP15.phx.gbl: > Hi, > I want to use UserDefined format for my CLR UDT and I need a formula > to calculate its MaxSize. sum of the sizes of all fields in the UDT is not allowed to be greater than 8K. In other words, if you have three integer fields, the size is 12. The pronlem occurs when you have variable length fields (strings for example), then you have to make sure the combined size of the fields do not exceed 8k. Niels -- ************************************************** * Niels Berglund * http://staff.develop.com/nielsb * nielsb@no-spam.develop.com * "A First Look at SQL Server 2005 for Developers" * http://www.awprofessional.com/title/0321180593 ************************************************** > I want to use UserDefined format for my CLR UDT and I need a formula to You have to implement the Write method by yourself, so it is up to you how > calculate its MaxSize. > Thanks in advance, long will it be. You have to persist your internal members (variables). So you check how many of them there are to persist, which data type do they use, etc. Also, you might add some (8?) bytes in the beginning of the serialized data for ordering and indexing. -- Dejan Sarka, SQL Server MVP Mentor, www.SolidQualityLearning.com Anything written in this message represents solely the point of view of the sender. This message does not imply endorsement from Solid Quality Learning, and it does not represent the point of view of Solid Quality Learning or any other person, company or institution mentioned in this message Hi Leila,
There are only two serialization choices in the SQL Server 2005 RTM. With a Format.Native UDT, you don't need to (in fact shouldn't) specify MaxByteSize, the Native serialization code will figure it out. Format.Native has some additional requirements, though, you can't use it with all UDTs. Check BOL for these requirements. The other choice is Format.UserDefined. With this format, you are in control of the UDT serialization, so you must know how you're going to write the UDT and what MaxByteSize should be. In no case can the UDT MaxByteSize exceed 8000 bytes in this release. Cheers, Bob Beauchemin http://www.SQLskills.com/blogs/bobb Show quote "Leila" <Lei***@hotpop.com> wrote in message news:eVTHivsHGHA.2300@TK2MSFTNGP15.phx.gbl... > Hi, > I want to use UserDefined format for my CLR UDT and I need a formula to > calculate its MaxSize. > Thanks in advance, > Leila > > > Thanks every body :-)
I had poblem with this sentence: "Number of control bytes of overhead incurred from serializing a binary stream". By reading your replies, I realized that I must not be worried about calculating these extra bytes if I am using Format.Native! But should I still care about it when I'm using Format.UserDefined? or there will not be extra overhead in addition to what I write on disk? Leila Show quote "Bob Beauchemin" <no_bobb_spam@sqlskills.com> wrote in message news:ORgVKQtHGHA.2012@TK2MSFTNGP14.phx.gbl... > Hi Leila, > > There are only two serialization choices in the SQL Server 2005 RTM. With > a Format.Native UDT, you don't need to (in fact shouldn't) specify > MaxByteSize, the Native serialization code will figure it out. > Format.Native has some additional requirements, though, you can't use it > with all UDTs. Check BOL for these requirements. > > The other choice is Format.UserDefined. With this format, you are in > control of the UDT serialization, so you must know how you're going to > write the UDT and what MaxByteSize should be. > > In no case can the UDT MaxByteSize exceed 8000 bytes in this release. > > Cheers, > Bob Beauchemin > http://www.SQLskills.com/blogs/bobb > > > "Leila" <Lei***@hotpop.com> wrote in message > news:eVTHivsHGHA.2300@TK2MSFTNGP15.phx.gbl... >> Hi, >> I want to use UserDefined format for my CLR UDT and I need a formula to >> calculate its MaxSize. >> Thanks in advance, >> Leila >> >> >> > > I was thinking they should add a Format.None so you could have something
like an Array type they really needs more then 8K, and you don't need as a column type either - you just need the type to work with. -- Show quoteWilliam Stacey [MVP] "Bob Beauchemin" <no_bobb_spam@sqlskills.com> wrote in message news:ORgVKQtHGHA.2012@TK2MSFTNGP14.phx.gbl... | Hi Leila, | | There are only two serialization choices in the SQL Server 2005 RTM. With a | Format.Native UDT, you don't need to (in fact shouldn't) specify | MaxByteSize, the Native serialization code will figure it out. Format.Native | has some additional requirements, though, you can't use it with all UDTs. | Check BOL for these requirements. | | The other choice is Format.UserDefined. With this format, you are in control | of the UDT serialization, so you must know how you're going to write the UDT | and what MaxByteSize should be. | | In no case can the UDT MaxByteSize exceed 8000 bytes in this release. | | Cheers, | Bob Beauchemin | http://www.SQLskills.com/blogs/bobb | | | "Leila" <Lei***@hotpop.com> wrote in message | news:eVTHivsHGHA.2300@TK2MSFTNGP15.phx.gbl... | > Hi, | > I want to use UserDefined format for my CLR UDT and I need a formula to | > calculate its MaxSize. | > Thanks in advance, | > Leila | > | > | > | | |
|||||||||||||||||||||||