0

My database name is Test and that database contain 1 Table. Table name is Test_Table

Here is my Test_Table:

id  data_id
0   Choose
1   Yes
2   No

What is the way of creating backup of database without data because i want only the structure of database Table.

I want that when i restore my database it only show me all Table without Data Like:

id  data_id

I am using SQL Server 2008.

John Conde
  • 217,595
  • 99
  • 455
  • 496
user3834541
  • 161
  • 1
  • 7
  • 27
  • Do not use tags that do not apply to your question – John Conde Jul 17 '14 at 15:43
  • possible duplicate of [Export database schema into SQL file](http://stackoverflow.com/questions/12036458/export-database-schema-into-sql-file) – Simon Jul 17 '14 at 15:46
  • 1
    This question doesn't make sense!! Creating backup without data? You might need to create a script – huMpty duMpty Jul 17 '14 at 15:49
  • Your question is a bit strange. If you want only the schema then create scripts to generate the schema. If you truly want a back then delete all the rows out of all your tables and create your backup. – Sean Lange Jul 17 '14 at 16:08

2 Answers2

1

In your Sql Server Management Studio:

  1. right click on the database in question.
  2. Choose Tasks
  3. Choose Generate Scripts...

Then just follow the steps in the wizard to choose which tables/sprocs/views/etc to generate scripts for.

Jason
  • 3,020
  • 2
  • 24
  • 23
  • If you want to create scripts for the database creation itself, just right click on the database and choose "Script Database As..." and follow the prompts (I usually do "Drop and Create", and "To New Query Window") - then just save that file. – Jason Jul 17 '14 at 16:53
0

you're asking for a database backup without data (that is not possible) but maybe we're speaking about source controlling your database structures.

In our dev teams, we installed a third party software which source controls the database structures and also lookup/domain/static data. This is maybe the way you want to follow. If you're a Visual Studio user, you can use the database project template in order to store your schema under VSO or git source control manager.

Alessandro Alpi
  • 368
  • 1
  • 6