Hi guys, I want to store recording(voice recording) in my SQL database. Please let me know is it possible and how ?


Recommended Answers

All 2 Replies

Since the size of a voice file can vary, I would not attempt to store the ACTUAL binary data in the database. I would put the data on a server (file-share, ftp., etc.) and store a link to it in the database. When it's needed, take the address from the database and go retrieve it from its resting place.

you can store the data in a column with the data type set to varbinary(max) which holds a varying length binary data object up to 2 GB in size.

Thines01 has a point though, depending on the server type (express versions etc...), the purpose of the server (just hosting files, or what?) you might run into issues. Database file size is nothing to ignore, just because you can hold 2GB of data in a column, doesn't mean it's the best way to do it.

You might want to look into enabling and using Filestream on your sql server instead.

From MSDN:

In SQL Server, BLOBs can be standard varbinary(max) data that stores the data in tables, or FILESTREAM varbinary(max) objects that store the data in the file system. The size and use of the data determines whether you should use database storage or file system storage. If the following conditions are true, you should consider using FILESTREAM:

Objects that are being stored are, on average, larger than 1 MB.

Fast read access is important.

You are developing applications that use a middle tier for application logic.

For smaller objects, storing varbinary(max) BLOBs in the database often provides better streaming performance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.