.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

SQL Script for Deleting the .mdf and .ldf files

Posted By: kamlesh     Posted Date: March 17, 2011    Points:5   Category :Sql Server

i want to delete the .mdf and .ldf files while uninstall the my application.

how it is possible please let met know...

Author: Dhiraj Ranka             
Posted Date: March 17, 2011     Points: 20   


How are you deploying your .MDF and .LDF files?

Is it you are creating SQL Database on fly or using .MDF and .LDF pre-loaded in your application.

If they are pre-loaded then you can delete these files in Uninstall script of your deployment software


If you are creating SQL Database on fly then you simply login to SQL Server and use following query

DROP DATABASE { database_name | database_snapshot_name } [ ,...n ]

Reference : http://msdn.microsoft.com/en-us/library/ms178613.aspx

Hope this helps

Hope this helps.

Thanks & Regards,
Dhiraj Ranka
http://www.twitter.com/dhirajranka | http://www.dhirajranka.com
Author: kamlesh             
Posted Date: March 17, 2011     Points: 20   


Thanks And Regards.
Kamlesh Nikam

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend