RE: Simple Problem - Simple Solution?
From: Nigel Rivett (NigelRivett_at_discussions.microsoft.com)
Date: 12/20/04
- Next message: Tibor Karaszi: "Re: 64bit insert delays"
- Previous message: Henrik Skak Pedersen: "Relation to a table name"
- In reply to: DBA72: "Simple Problem - Simple Solution?"
- Next in thread: Brandon Lilly: "RE: Simple Problem - Simple Solution?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 20 Dec 2004 08:07:03 -0800
well a loop doesn't take much code - something like
declare @plan_id varchar(36)
select @plan_id = '00000000-0000-0000-0000-000000000000'
while @plan_id < (select max(convert(varchar(36),plan_id)) from
msdb..sysdbmaintplans)
begin
select @plan_id = min(convert(varchar(36),plan_id)) from
msdb..sysdbmaintplans where convert(varchar(36),plan_id) > @plan_id
exec sp_delete_maintenance_plan @plan_id = @plan_id
end
"DBA72" wrote:
> I want to execute a stored proc. multiple times with the least amount of code.
> For example, I want to execute: "sp_delete_maintenance_plan @plan_id = xxx"
>
> from the following list:
> "SELECT plan_id
> FROM msdb.dbo.sysdbmaintplans
> WHERE plan_id <>'00000000-0000-0000-0000-000000000000'
> GO"
>
> Is it possible to do this without using a loop or a cursor?
>
- Next message: Tibor Karaszi: "Re: 64bit insert delays"
- Previous message: Henrik Skak Pedersen: "Relation to a table name"
- In reply to: DBA72: "Simple Problem - Simple Solution?"
- Next in thread: Brandon Lilly: "RE: Simple Problem - Simple Solution?"
- Messages sorted by: [ date ] [ thread ]