I'm trying to move a database from a server in one data centre to a server in my local data centre. The pipe between the two is very slow. Luckily I only need to transfer the schema, not the data. Is there an easy way in SQL Server to transfer just the schema of a database without the data?
4 Answers
Go to Management Studio's Object Explorer and select Tasks > Generate Scripts ...
Then step through the wizard, select those objects you need, select whether to script out to a single file or to a file per table / view - whatever you need.
Then transfer the .sql
script(s) to the target system, launch Management Studio there, run the scripts - done!

- 732,580
- 175
- 1,330
- 1,459
One approach would be to generate scripts of your existing database (in SSMS right-click the database, then Tasks, then Generate Scripts ...). Go through the wizard to generate your script file(s). Then run the script(s) on the target system.

- 6,106
- 2
- 20
- 24
There are a variety of third party tools which can do this for you pretty easily, such as Red Gate's SQL Compare and DB Ghost. ApexSQL has a free, community version of ApexSQL Diff. Devart has a dbForge Studio Express for SQL Server which has schema compare capabilities.
There are also several other questions on Stack Overflow which provide some ideas:
- Free Tool to compare Sql Server tables [closed]
- Best tool for auto-generating SQL change scripts for SQL Server [closed]
- Anyone know of any good Database Diff tools? [duplicate]
Microsoft's Visual Studio can even do schema comparisons now.
But you should be able to script the entire database using SQL Server Management Studio (SSMS) as Marc S's answer now describes. This option was also proposed by Chris Brandsma in his answer to Script entire database SQL-Server.

- 1
- 1

- 1,904
- 23
- 36