exporting data in sql server 2012 - sql-server

i am trying to export data from the database I created in SQL Server 2012 so that I may take it to school and copy it all over to the main server there. I was shown how to do it on campus in the computer lab but whenever I right click the table and go for Tasks>Export There is not an option for Tasks. I also couldn't just generate the script I had to Right click table, Script Table as>Create to>New Query. Any suggestions?

Right-click at the database node in SSMS Object Explorer (you're probably right-clicking a table node which wouldn't have "Export") (I assume you're talking about SQL Server Management Studio)
Here's a screenshot (Microsoft SQL Server Management Studio 10.0.2531.0):

Rightclick on database->click attack-> selct your database...
Make sure that data base backup should be make from that system... then only it will work.. if you copy from other sysytem means it wont work..

Related

unable to copy a database inside the same server using the Copy Database wizard

I have sql server 2008 R2. and I want to take a copy of a database inside the same database server. so I will have exact copies of the database. now I login to the sql server management studio>> right click on the database >> tasks>>copy database. where I was prompted with the copy database wizard. I select the database I want to copy, and I name the new copy as Test_Copy, and I select to run the operation immediate ... now I got this error:-
so can anyone advice what might be causing this problem ?
Thanks
You need to open up the Server is SQL Server Management Studio and find the SQL Server Agent at the bottom under the server and right click then start.
If you would rather you can log onto the server and find services and then scroll down until you find SQL Server Agent Services and start those. Doing either rof these should fix your problem.
When I run the copy database wizard, i get the following dialog when Agent is not running
It's my understanding that the wizard creates a package with a series of steps that is all managed by the agent. Because the agent is controlling and sequencing the process, it needs to be enabled.

How to export the localDb to an online Sql Server Database?

I used visual studio 2013 for developing a web application and used a localDB in development phase, now I want to go to production phase and want to export the sql server localDb to the online SQL server database, but I cannot find any option to script out the localDb or migrate it?
Which tools I can use to do this ? or what I must do?
There are atleast two routes; you could publish and recover as Data Tier Application:
Or, the easier-but-lengthier route would be to:
Create a new DB in the SQL Server Management Studio (Naming it the same as LocalDB is helpful if you just want to change the connection string later)
Right-click database on SQL Server Object Explorer and select Schema Compare
Click Select Target and navigate through Select Target Schema(Dialog) > Database > Click on Select Connection > Connect(Dialog) > Browse > Local > Database Name > Select the Databse you created in Step-1. Then, click OK
Click Compare or, hit Shift+Alt+C
Then, the Schema Comparator tells you whats different between the two databases (the one from MSSqlLocalDB and the one you just created in Step-1). It is important to remember unchecking ANY entries for delete operations, if you are simply transferring data and schema. Keep add operations as it is.
Then, click on ↑UPDATE (the option is located right beside Compare)
Your Target database should be updated
You can attach the localDb to SQLServer 2005 or higher and then you can generate scripts or export data to remote server.
Or
If LocalDb is SQL Server 2012, use SSMS 2012 or later for this scripting task.
Unfortunately VS2013 does not has any feature to script out a localDb, I waste so many time to copy table by table scripts, and run it at remote db. my local db id sql v11.0 (2012 I think). and the remote db was sql server 2008. so one way exist is to install an instance of sql server 2012 and sql server management studio to script out my db. maybe another tools also exist it is very sad that vs has not this feature.

restore a sqlserver 2005 database into sqlserver 2012

I have a db running on an instance of sqlserver 2003, Ive tried to import it into sqlserver 2012 but that wont work it's says it's to old.
so I've imported it into sqlserver 2005, I have then backed it up again and tried to import it into sqlserver 2012 but it comes up with the same error.
I can restore other db's from sqlserver 2005 so I can only presume its keeping its 2003 settings when I back it up.
Can anyone help
I suspect that your database might have some deprecated functionality that prevents your upgrade from working.
There's a list of deprecated functionality between SQL Server 2000 and SQL Server 2005 on technet.
I would strongly advise you to use the SQL Server 2005 Upgrade Advisor to identify such functionality, and address any potential issues. Then, and only then you should have a database compatible with SQL Server 2005, and can (hopefully) proceed from there.
if u want database structure only then take database script then run into sql server 2005, if u want database with data also mean
right click the Database go task
click Generate Script
There Two options entire database or with specific objects
entire database for DataBase structure only
with specific objects - select all objects then click Next you find the Advance button then click it.
scroll down and Find Type of Data Scripts click and change to Schema and data then you will save as file file or new query window
this is one of the method to restore the database.
Set your compatibility level to (90) Sql server 2005 in your database properties after restoring.

Import data from SQL database on server to SQL database on localhost

We have a database with a very large amount of data in it (around 400k records per table). I'd like to be able to debug a stored procedure on this database, however I do not have the permissions to do that on the server it's on.
As such, I need to create a replica of the database on localhost and debug from there.
However.. due to the large size the script that gets created is too large for SQL Server Management Studio to open.
Is there a way to directly import the data from one database to another if one is located on localhost and the other is not? The security issues shouldn't be a problem for importing/exporting data, I'm told.
Just create a binary backup of the source database (e.g. using SQL Server Management Studio, right click on the database, then select Tasks -> Back Up), then import that .bak file into your local installation - again using Management Studio, right click on the "Databases" node and choose Restore Database.
The only thing that might prevent you from doing that is if you are running SQL Server Express locally and the total size of the source database exceeds the size limit of the Express edition.
If you can connect to the server database from your computer, you can use SQL Server Management Studio, right click the Database, menu option Tasks and then Copy Database. You'll see an easy wizard asking for source and destination databases.
You can also create a backup through SQL Server Management Studio and restore on your computer.

How to copy an existing DB in SQL Server 2008 r2 management studio?

I am trying to copy an existing DB, which exists in SQL Server 2008 r2 management studio including data.
Is there any option to copy database in the management studio?
Right click on the database in Object Explorer -> Tasks -> Copy Database
You also need to make sure the SQL Agent (SQL Server Agent (MSSQLSERVER)) service is running
Right Click Database which you want to export. Then choose task from the options now you can export the data or you can generate script which you can run on another server.
For Generating the script choose it and wizard will open up. then decide where you want to save the script.
You have to remind you have to hit advanced button and select type of data to choose select schema and data for getting data in the database other it will select only structure of the database.

Resources