November 3, 2004 at 5:25 pm
I know that I can use T-SQL to add a dump device (EXEC sp_addumpdevice ...) and then run a backup.
But if I run the script again, I get an error, because the dump device already exists.
So how do I modify the script to include a check for existence of the device before creating it?
Thanks
Phil
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
November 3, 2004 at 7:39 pm
Have a look at sp_helpdevice. If run with no parameters it will return a recordset containing all devices. A status of 16 is a backup device.
November 3, 2004 at 8:26 pm
Thanks - the returned recordset contains the info I need, but how do I query it as part of my script? sp_helpdevice itself returns just 0 (success) or 1 (failure).
Phil
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
November 3, 2004 at 8:32 pm
create table #devices (DeviceName varchar (100), PhysName Varchar (100), Description varchar (100), status int, cntrltype int, size int)
Insert into #devices
Exec sp_helpdevice
select * from #devices
Check the lengths of the columns in the temp table - I suspect that they be not be adequate.
November 3, 2004 at 8:56 pm
Thanks very much, I'll try that.
... tried it now and works a treat - thanks v much.
Phil
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply