Question :
I am working with a more experienced database admin and he wants me to send him a database that I created. However, I cannot figure out where the database is stored on disk. I am using Microsoft SSMS.
Answer :
Select a.name, b.physical_name
from sys.databases a
join sys.master_files b
on a.Database_id = b.database_id
Where a.name = 'NAME_OF_YOUR_DATABASE'
This will show you the location on disk.. (can’t move it though).
Backup the database:
BACKUP Database NAME_OF_YOUR_DATABASE
To Disk = N'C:DatabasesNAME_OF_YOUR_DATABASE.bak With Compression