4

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?

0

3 Answers 3

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, I am going to over the next couple of days, I just wanted a quick way to verify that the file was being uploaded correctly. Currently in my database, the binary data is showing as "0x00000000......" which doesn't seem right to me. I guess I'll be working on the viewer sooner than expected!
1

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.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.