I have a database to which I upload files (e.g. PDF files, images, etc.). I save them in the database as Varbinary (max).
I upload these files using C # MVC. I was wondering how I can view these files using a T-SQL query, not .net.
Is it possible?
Not directly.
Why don't you write a simple application to view?
There are free and commercial ones. I have not used this, but it has a trial version: SQL Image Viewer
No, you need to extract the files to view them.
SQL Server and SSMS (SQL Server Management Studio) are not able to view binary data in this way.
You can use the sp_OAxxxx functions (COM interaction functions) to create the appropriate viewers, but ultimately these viewers will need the data recorded on the disc.