Solved

binary data datatype

Posted on 2012-03-11
3
355 Views
Last Modified: 2012-03-16
We want to serialize some of our c# classes into a database column.  We are going to use binary serialization.  
What would be the best datatype to store the binary data?  Should we use varbinary(max)?  The classes are not very large and when serializing to the file system they are about 7Kb.
Any suggestions?

CREATE TABLE [dbo].[ClassTable](
      [ID] [int] NOT NULL,
      [ClassData] [varbinary](max) NOT NULL,
 CONSTRAINT [PK_ClassTable] PRIMARY KEY CLUSTERED
(
      [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
0
Comment
Question by:tampsystems
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 500 total points
ID: 37708571
varbinary(max) is your best bet, since you don't know before hand what size you would need in the future
0
 

Author Comment

by:tampsystems
ID: 37709299
now what if we need to store it using text (XML), would varchar(max) be the best bet too?
0
 
LVL 25

Expert Comment

by:jogos
ID: 37709530
If you only want to use it trough your C# it don't makes a lot of difference.

There is also the XML-datatype, but that will be slower in performance.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question