Let's have a little fun today. SQL Server stores data in MDF file which is a binary file. We will open a MDF file and search for any content. Let's start.
Start the Game
Let's follow below steps:
- Create a new Database
- Create a new table
- Put some data to this table
- Select the data from this table
- Take the database offline
CREATE DATABASE [TestDBA];
GO
USE [TestDBA];
GO
CREATE TABLE [dbo].[Table1]
([ID] INT IDENTITY(1,1) PRIMARY KEY CLUSTERED,
[Name] VARCHAR(50),
[Address] VARCHAR(50));
GO
INSERT INTO [dbo].[Table1]([Name],[Address])
VALUES ('Mehedi','Dhaka'),
('Hasan','Dhanmondi'),
('Shaer','Dhaka')
GO
SELECT * FROM [Table1]; -- select data data
GO
ALTER DATABASE [TestDBA] SET OFFLINE WITH ROLLBACK IMMEDIATE;
GO
Now:
- Open the .mdf file with a hex editor – You may use the free xvi32 because it does not require installation. Just download it.
- Search for the keyword Mehedi. You will find one occurrence.

Final Words
So, you opened and check the content of a MDF file.
Going Further
If SQL Server is your thing and you enjoy learning real-world tips, tricks, and performance hacks—you are going to love my training sessions too!
Need results fast? I am also available for 1-on-1 consultancy to help you troubleshoot and fix your database performance issues.
Let’s make your SQL Server to take your business Challenge!
For any queries, mail to mamehedi.hasan[at]gmail.com.