Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Respected sir,
I have created Data.mdb for my windows application in which i have many tables.
now i want to create same but new and blank database having same tables for every year without old data at runtime
how to do this..

Please help me..
Thank you..
Posted
Updated 9-Oct-12 21:38pm
v2

1 solution

Inside MS SQL Management Studio

1- Right Click your Database
2- Tasks - > Generate Script
3- follow the steps appeared to you in pop-up (choose to select All, it will select all of your tables, views, procedures etc)
4- choose to generate file at any of your specified location

5- open that file
6- go into that file and replace your database name with new database name... i.e Replace [MyDB] to [MyDB2]

7- it is a complete query to generate new database with same database schema.
8- Just run that query and a clone of your database [MyDB] with be ready for you with name [MyDB2]
 
Share this answer
 
Comments
Sunil Bansode 10-Oct-12 5:26am    
Thank you sir for replying ...
But i have used MsAccess for database and not using MS SQL..
then how to do this in MS Access...???
Thanks
Zubair Alie 10-Oct-12 8:47am    
i think in MS Access you need to generate another copy & Truncate all the tables.
what my practice is, i remain with my empty tabled MS Access file inside code directory & place its replica in User AppData folder. during testing environment use the .mdb file placed inside User's AppData folder. This way, while deployment you remain with clean database and you do not need to delete all the rows you inserted while development or testing.

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