Click here to Skip to main content
15,670,482 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
It is Good to Store Video in Binary Format in sql server?

i used this for image and mp3 both working fine.

But when using Video then i'm able to store video but i'm unable to play

1 solution

You can store video in SQL server, but I would strongly advise against it.
There are a couple of reasons for this:

1) The total size of a database is limited (how much so depends on the version of SQL server you are using) and video is generally pretty big: running around 500MB per hour, or more for hi res it doesn't take many videos to fill a DB to capacity.
2) When you store video in SQL you have to retrieve it from SQL - and that means that it uses the SQL Server Instance bandwidth at a phenomenal rate - it can seriously slow down other users (and your code, since SQL doesn't have any concept of "streaming" data and returns it as a monolithic object)

For these reasons, I would store the video in a file, and store the address of that file in SQL. (I also recommend this for images where the image is bigger than thumbnail size, say 100x100 pixels)
Share this answer
Surendra0x2 16-Jan-13 8:22am    
Thanks Sir,and can u clear my doubt what about mp3 files it would be good if i store mp3 using varbinary(max) format or just store song'name and retrieve.
and for image what if image is between 1 MB to 5MB then it would be good to store as image datatype and retrieve?
OriginalGriff 16-Jan-13 9:30am    
MP3 is on the borderline - it would depend on the traffic levels to an extend - given that are the same size (pretty much) as images @ 1~5MB, but MP3's tend not to be retrieved as quickly - a user can only listen to one of them at a time, and probably won't expect a new one every 5 seconds! :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900