Forums » SQL Server Forums » LiteSpeed for SQL Server

Thread: xp_objectrecovery_createscript question

This question is answered.


Permlink Replies: 1 - Pages: 1 - Last Post: Nov 6, 2009 11:21 AM by: David Gugick
David.Garrett@bcbsne.com

Posts: 50
Registered: 10/8/08
xp_objectrecovery_createscript question
Posted: Nov 5, 2009 11:38 AM
 
  Click to reply to this thread Reply

Is there are a way of concatenating multiple runs into one file. 

These statement create two separate files and I would perfer them to be in th same file.  If I give it the same filename, the second overwrites the first.

EXEC [master].[dbo].[xp_objectrecovery_createscript]

@filename = '\\sploma01prd\Backups\SPLOMA01PRD\DataMgmt\Backup\DataMgmt.smartdiff.f5.bkp',

@objectname = 'dbo.PrimeSecondList',

@scriptfilename = 'D:\Table_PrimeSecondList.sql',

@type = 'Table'

EXEC [master].[dbo].[xp_objectrecovery_createscript]

@filename = '\\sploma01prd\Backups\SPLOMA01PRD\DataMgmt\Backup\DataMgmt.smartdiff.f5.bkp',

@objectname = 'dbo.PrimeSecondList',

@scriptfilename = 'D:\TableIndexes_PrimeSecondList.sql',

@type = 'TableIndexes'




David Gugick


Posts: 162
Registered: 7/9/07
Re: xp_objectrecovery_createscript question
Posted: Nov 6, 2009 11:21 AM   in response to: David.Garrett@b...
Answered
  Click to reply to this thread Reply

You can do this using the @ObjectFileName parameter. You can specify any number of files to extract. The contexts should look something like:

Table,dbo.IncTest
Table,dbo.CollationTest


The command to execute looks like this and the resulting SQL file will contain all the DDL:

EXEC [master].[dbo].[xp_objectrecovery_createscript]
@filename = 'c:\backup\AdvWks.bak',
@objectfilename = 'C:\Backup\OLRObject.txt',
@scriptfilename = 'C:\Backup\OLRTest.sql'

--
David


Legend
Guru: 2001 + pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums