What is a good Microsoft SQL Database Export / Import tool? - sql-server

I need a tool that will look at a Microsoft SQL Server database and export the data as a SQL script. I want to be able to run the script on another box with an empty database and insert all the data from the previous one without having to muck with the index's due to ref-integ constraints.

Try a tool like Red Gate Data Compare or DBGhost. Both have trials I believe.
http://www.innovartis.co.uk/
http://www.red-gate.com/products/sql_data_compare/index.htm

Use Microsoft SQL Server Database Publishing Wizard.

Depending on what version of SQL Server you have, you can right click the database, choose generate scripts, choose the tables you want, and uncheck the option to script structure and choose the option to script the data.

If you're using Visual Studio 2008 or above you should be able to script out the database when you do a publish of the website/web application. Scott Guthrie has a few examples of how to do this out of Visual Studio 2005: Deploying a Database Part I and SQL Server Database publishing kit.
Hope this works for you.

I decided to go with Redgate SQL Packager it create a very nice script for the entire DB or an exe that will install it if necessary

Related

Can't find Microsoft SQL Server even if it is installed?

Regarding the following images, I have obviously installed the Microsoft SQL Server, but I can't find the exe-file or anything named Microsoft SQL Server in the start menu.
Anyone who knows what to do to solve this, or do I need to install something more?
SQL Server runs as a service. You can start and stop it from windows services. SSMS is a gui tool for managing ddl (creating and altering tables and index's for example) and dml (writing queries to inquire, update or add data to databases).SSMS comes free with every edition of SQL server - perhaps you didn't tick a box when installing? You can also do this stuff the old fashioned way using sqlcmd from command line(DBAs love this for some reason) but for us mortals SSMS is much less of a struggle. As an aside there are other guis such as Toad (expensive) and Heidisql (free) amongst others which will do the job.
Looks like you have the engine. What you've got to do now is install SQL Server Management Studio: https://msdn.microsoft.com/hr-hr/library/mt238290.aspx
Looks like you have the various SQL Server components that are installed by Visual Studio (recent version) or SQL Server Data Tools (as used by VS).

Restore SQL Server database from a script

I have a database stored on SQL Server with my web site at a regular windows hosting solution. I need to migrate to Azure.
The only backup mean I have is to use SQL Server Management Studio and do a Task -> Generate scripts that saves schema and data in a sql file. I did it and I got a 260Mb file.
My question is about importing that to Azure. Can I do it in Mngt Studio too? How?
Thanks
If you have exported it all to scripts, yes, you can run them against your SQL Database. However, before you do that I'd suggest looking at https://azure.microsoft.com/en-us/documentation/articles/sql-database-cloud-migrate/. It might shed some light on other options that will include verifying compatibility. The BacPac method might be better than the scripts.
To answer the specific question of using SSMS with Azure SQL DB, this article https://azure.microsoft.com/en-us/documentation/articles/sql-database-manage-azure-ssms/ shows how to make the connection.

Transfer a SQL Server database without data

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!
I would use the SQL Server Publishing Wizard for this.
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:
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.

Can SQL Server synchronise a live database and a create script to make an update script?

We are currently updating our SQL Server database create and update scripts by hand, and I'm looking for a better way.
I've worked extensively with MySQL Workbench before, and it has functionality to update a database creation script to match a live database, and in the process also produce an update script.
Is there similar functionality available in SQL Server? If so, can you please provide references to it?
If you're using Visual Studio, the answer is SQL Server Data Tools (SSDT). It comes with SQL Schema Compare functionality. Check it out here: http://msdn.microsoft.com/en-us/data/tools.aspx
SSDT can also do a lot of other stuff, like automated database testing, automated build and deployment of databases, etc.
There are also 3rd party alternatives, such as Red Gate's SQL Compare: http://www.red-gate.com/products/sql-development/sql-compare/

Easiest way to copy an entire SQL server Database from a server to local SQL Express

I need to copy an entire database from a SQL Server 2005 on my server over to my local SQL Express in order to run my application for a presentation. What is the fastest/easiest way to get this done?
EDIT: I have very limited access to my server so I don't think I can access the backup file that I could create so that is out.
If the database is not too big, you could use the Database Publishing Wizard.
This is a free tool from Microsoft which creates a complete SQL script of a database for you (not only the tables and stuff, but all data as well).
You can install the tool on your machine, connect to a remote server and let the tool create the script directly on your machine.
You can download the Database Publishing Wizard here.
Apparently the link above doesn't work anymore in 2019.
That's probably because in newer versions of SQL Server Management Studio, the functionality of the Database Publishing Wizard is included out-of-the-box, so there's no need to install it separately.
It's now called the Generate and Publish Scripts Wizard, but it does exactly the same.
You can right click the database -> Tasks -> Generate scripts. Here you can select one, multiple, or all objects. Then in the 'Set Scripting Options' step of the wizard, click Advanced. In here set the property 'Types of Data to script; to Schema and Data.
Having done these steps, make sure you publish to a file. Because only file can handle large amounts of data.
Now you should have all your objects, tables, and data scripted. Now start running the scripts and viola!
Back up the database on the server and then restore it locally in SQL Express.
EDIT: If this is part of your work, surely you can get someone in networks to get you a backup..?
If you can login to both servers (the Express and the 05 Server) using SQL Server Management Studio then you can do a DB Restore from one database to the other. No need for backup files at all.
You can use SSIS's database copy wizard, but it's not quick at all. Is there a DBA there that you can ask for the backup file? That will probably turn out to be the fastest way.
Depending which versions of SQL Server you are using, you might get some mileage out of the SQL Server Database Publishing Wizard from Microsoft. I've had mixed results with this tool in complex environments, but for most simple database scenarios it is a great tool.
An example of a scenario where I ran into difficulties was a DB with multiple distinct schemas, each with their own owner and extreme separation between the tables (don't ask...). As I said, though, most other scenarios have been fine.
Save your database as a sql script
EMS SQL Manager (for example) allows you to backup your database as a script in a .sql file. It is then possible to run this file against any other SQL server. Just update the first line of the script (CREATE DATABASE ....).
You can even fully parameter the script in order to include data from complete or filtered tables.

Resources