Click here to Skip to main content
15,900,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Lets say I have the Northwind sample database.
Now I want to create a dummy database using a query.
Is there a way to do this?

Please tell me the solution considering the fact that I want to use a query.

Many tanks.

<Edit - Removed shouting>
Posted
Updated 26-Sep-11 7:20am
v2
Comments
Mehdi Gholam 26-Sep-11 12:32pm    
WHY ARE YOU USING UPPER CASE?
CPallini 26-Sep-11 13:01pm    
Technically speaking you cannot create a database using queries (you need DDL statements). Could you please elaborate?

1 solution

The best way to duplicate your database is the following :

1) backup your db.
2) restore to a new database name.
3) do a truncate table [tablename] on all your tables.
4) shrink your new database.
 
Share this answer
 
v2
Comments
sachin10d 27-Sep-11 0:03am    
use this query to truncate all your tables.
select 'truncate table ' + table_name from INFORMATION_SCHEMA.TABLES

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