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?
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!
我会使用SQL Server发布向导 。
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.
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:
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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.