List files stored in Filestream database

We recently implemented Filestream in a MS SQL 2008 database to store transaction related documents for our accounting system (Deltek Vision). After a server crash and restoration of VHDs to different hardware the main database is out of sync with the Filestream database. This was caused because I did not have a simultaneous backup of the Filestream database. We were able to re-enter the missing files but somehow the filestream is now showing one more files than the main database.

How can I most simply list the names files stored in our Filestream database, so I can identify the extra file? Once identified, what is the easiest way to remove the file?

My knowledge of SQL is limited to following instructions and performing  tasks within SQL Management studio.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Walter RitzelSenior Software EngineerCommented:
It is a regular SQL. Try first to get the field names on the table.
select Name, ContentType, Data from tblFiles where id=<put your id>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Walter RitzelSenior Software EngineerCommented:
rkirkleyAuthor Commented:
Thanks Walter,

You pointed me in the right direction. I was able to get the lists I wanted with the following.

USE <Filestream Database Name>; select FileID from dbo.FW_Files
Which I am able to compare to
USE <Assosciated Database name>; select FileID from dbo.FW_Files
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.