January 22, 2003 at 8:39 am
Hi,
I have a script to run to restore adb from a backup which has come from another server. I know where the file will be, but not what it is called. I have tried to do a bulk insert inot a temp table from a folder, but I can't get it to work.
I need this to be in place urgently, and I wondered if anyone could give me the correct xp_cmdshell command to find this file? I know the first part of the filename, but as it will have a date/time on it, I don't know the exact name.
Sorry if this is garbled, I am feeling the pressure of 101 tasks before go live (you have all been ther, I'm sure)
Thanks in advance!!!
January 22, 2003 at 11:20 am
Xp_cmdshell 'dir' will get you started. You'll have to provide the path to the folder containing the file to see the file name, worst case start at 'dir c:', work your way down.
Andy
January 23, 2003 at 7:33 am
I have done something very similiar setting up a staging server. I know where the backups are but not what they are called.
use xp_cmdshell 'dir c:\filename*.*'
SET @sqlcmd='master..xp_cmdshell '+char(39)+'dir \\'+@primary_server+'\backup\*.bak /b'+char(39)
insert into #files_to_restore
exec (@sqlcmd)
This inserts them into a temp table so that you can find them
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply