Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
use sql mdf file in pendrive, I tried using AttachDbFilename but it currupt after some time, please guide me how to use mdf from pendrive
Posted

1 solution

Basically there is nothing wrong in using a database file from a pen drive. The critical thing is to ensure that data is written correctly to the drive before removing it. So the sequence to use the database file should be:
- connect the pen drive
- attach the database file
- use it
- detach the database file
- safely remove the pen drive (instruct Windows to detach it)

The reason for the corruption could be that all the data wasn't successfully written to the pen drive before it was disconnected.

To find out more about the reasons for the corruption, investigate the error log from the SQL Server.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900