Click here to Skip to main content
16,008,175 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
How to create new database from existing database which should include only schema but not data and also all Objects like Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects.
Posted
Updated 13-Sep-11 3:31am
v2

1 solution

Take back up of database
create new database, restore the backup in your newly created database

run the below query in sqlserver editor copy the output of the query
open new Query window paste the output and run(F5), this will truncate all the table data

SQL
select 'truncate table ' + TABLE_NAME  from INFORMATION_SCHEMA.TABLES  where TABLE_TYPE like 'BASE TABLE'
 
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