Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an database in sql server. It has some tables. I want create new database like existing database with different name, When I create new company in my project.And I access that database for specify company. So I create new database like existing database. Please anybody help how to do it, at runtime.
Posted

You need to :
1) Backup the database
2) Restore the backup to a new database name.
3) Truncate Table [insert table name] for all your tables.
 
Share this answer
 
Comments
devausha 19-Apr-12 1:24am    
How to do this at runtime using c# and asp.net
Mehdi Gholam 19-Apr-12 1:38am    
Check Deepak Sharma's link.
 
Share this answer
 
Comments
Mehdi Gholam 19-Apr-12 1:38am    
Great link! my 5!
Hi ,
You can Generate script to old DB and then Execute the Script on the new DB
Check this link Here[^]
Best Regards
M.Mitwalli
 
Share this answer
 
 
Share this answer
 
Comments
devausha 19-Apr-12 1:43am    
Thank you Very much. It is good idea
Mohammad A Rahman 19-Apr-12 1:45am    
Not a problem :)

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