Reputation: 16897
I have a database to which I upload files (such as PDFs, images, etc). I save these to the database as Varbinary (max).
I upload these files using C# MVC. What I was wondering is how can I view these files using a T-SQL query, not .net.
Is this possible?
Upvotes: 4
Views: 1985
Reputation: 300728
Not directly.
Why don't you write a simple viewer application?
There are free and commercial ones out there. I haven't used this one, but it does have a trial version: SQL Image Viewer
Upvotes: 4
Reputation: 65546
You can use the sp_OAxxxx functions (the COM interaction functions) to create the appropriate viewers, but ultimately these viewer will require the data written to disk.
Upvotes: 0
Reputation: 499232
No, you need to extract the files in order to view them.
SQL Server and SSMS (SQL Server Management Studio) don't have a facility to view binary data in this way.
Upvotes: 1