Backup a single table in SQL server not using Select into - sql-server

For SQL Server 2008 is there an out of the box way to backup a singe table? On other database I've seen straightforward backup and restore commands for a single table but have not found it on SQL Server.
I am looking for commands like backup table and restore table which I've come across for other databases.

Use powershell to copy the table from one server/database to another.
http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/06/use-powershell-to-copy-a-table-between-two-sql-server-instances.aspx
This uses the sql client library and bulk copy. As long as you have credentials, this can be executed anywhere as long as powershell is installed!

There is one option using SSMS.
Check this out.

Related

Perform SQLDump on SQL Server

Is there a way to perform a SQL Dump in a SQL Server? Because on mysql we can easily do that with mysqldump command but on a SQL Server when I try to export the data it seems that it's only allowing to export per table and not per database. Now when I try to do the copy database it tries to copy the source db to a destination db. Now I came from MYSQL and I thought that it will somehow behave the same way.
Any idea on how to achieve this?
Thanks for those who will reply
In SQL Server you would either use Backup and Restore, or extract all the schema and data into a .bacpac file.

SQL Server Management Studio: Backup and restore database without data

Is there a way to backup and restore a database without the data. I just want the tables, scheme, stored procedures, etc. without the data.
How to backup the database?
How to restore it in SSMS?
If I'm not mistaken you can do this:
Right click the database
Select Script Database As
Select Create to
Select file
This gives you a script that you can run on a different server to set up the db.
Update:
You probably need to follow the steps here

How to transfer a SQL Server table from one server to another

What is a good way to transfer a table from one SQL Server instance to another server with an available FTP?
Use 'Generate Scripts' to script table creation and use the SSMS Tools' 'Generate Insert Statement' feature to create a script to populate the table. Simple, ad completely disconnected.
And alternative would be to backup the DB, restore it to a parallel DB on the new server, and copy from DB to DB (via SELECT INTO)
Have you tried using a linked server from server A to server B?
Here's one way (using TASKS via SSMS): http://msdn.microsoft.com/en-us/library/ms142159.aspx
Here's another way (using SSIS): http://msdn.microsoft.com/en-us/sqlserver/cc511477.aspx

How do I restore a single table from a SQL Server 2005 backup?

I've got a backup made using the regular SQL Server 2005 backup command. Is there a way to restore just a single table, not the whole DB?
Restore the whole database to another machine (or temporary database), then copy the table seems like the easiest to me.
This is not natively supported in SSMS but it’s possible using third party tools.
Apart from Red Gate (great tools btw) you can try SQL Diff (restore object) and SQL Data Diff (restore data) from ApexSQL.
Disclaimer: I’m not affiliated with ApexSQL but we are their customers and use their tools
The unit of backup and recovery in SQL Server is the database (it is the outer boundary of referential integrity).
Red Gate has some pretty good tools for row-level restore (SQL Data Compare and SQL Backup), but they come at a price.
Detach the current database then restore the database with the date of the tbl you need to a new location (make a sub folder) to put it in keep it separate from your production databases, then restore the database to that sub folder, when completed find the tbl you need and script it to a create script file save to a file, your done with the database delete it then reattached the original one, now scroll down to the tbl you want to restore and script it to a create file (this is a backup only) now delete the tbl, make sure your database is selected and the active one next load the the scripted file you just created with the other database in the query analyzer and run it, it should report successful now check to see if your tbl has been replaced. your done

How can I copy data records between two instances of an SQLServer database

I need to copy some records from our SQLServer 2005 test server to our live server. It's a flat lookup table, so no foreign keys or other referential integrity to worry about.
I could key-in the records again on the live server, but this is tiresome. I could export the test server records and table data in its entirety into an SQL script and run that, but I don't want to overwrite the records present on the live system, only add to them.
How can I select just the records I want and get them transferred or otherwise into the live server? We don't have Sharepoint, which I understand would allow me to copy them directly between the two instances.
If your production SQL server and test SQL server can talk, you could just do in with a SQL insert statement.
first run the following on your test server:
Execute sp_addlinkedserver PRODUCTION_SERVER_NAME
Then just create the insert statement:
INSERT INTO [PRODUCTION_SERVER_NAME].DATABASE_NAME.dbo.TABLE_NAME (Names_of_Columns_to_be_inserted)
SELECT Names_of_Columns_to_be_inserted
FROM TABLE_NAME
I use SQL Server Management Studio and do an Export Task by right-clicking the database and going to Task>Export. I think it works across servers as well as databases but I'm not sure.
An SSIS package would be best suited to do the transfer, it would take literally seconds to setup!
I would just script to sql and run on the other server for quick and dirty transferring. If this is something that you will be doing often and you need to set up a mechanism, SQL Server Integration Services (SSIS) which is similar to the older Data Transformation Services (DTS) are designed for this sort of thing. You develop the solution in a mini-Visual Studio environment and can build very complex solutions for moving and transforming data.

Resources