Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore tables only from backup.

Status
Not open for further replies.

djj55

Programmer
Feb 6, 2006
1,761
US
Hello, SQL 2008R2
Is it possible to restore just the table and not the stored procedures/user defined functions, from a full backup?

This would be used to update our development server.

Thanks,

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
not natively - only way with plain SQL Server tools is to restore the whole database.

What most do is to restore to another database, and then copy the objects required to the real destination database.

Some commercial tools seem to allow for this. RedGate might be one of them, but I don't know for sure.

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
I can copy the tables directly, but with foreign keys and other things it is a real pain, yet it can be done.

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
You can do a bcd through the cmd prompt, here is a link on how to use it
That or if you just need a few rows you can write an insert statement.
If you want to create a new table and you have a backup of the database that had the original table in question, and a test database to restore that backup to you can write a insert which I've included an example of below.

Create Table dbo.<your new table name>(
<Columns> (Ex: [Name] [char] (15) NOT NULL)
)

Insert into dbo.<your new table name>

SELECT <columns from other table that match colums in new table created>
FROM <database name>.dbo.<original table name>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top