I am trying to clean up a WSUS DB, there are 2 stored procedures to help
exec spDeleteUpdate @localUpdateID=xxxxxx
I'm trying to automate this a little so I wrote a little script to create a temp table, put the results from the first stored procedure in that then loop through the temp table running the second stored procedure against every entry...
The first part works, the second part doesn't appear to, anything glaringly obvious that I've done wrong...? Oh, and is it possable to make it have some sort of out put so I know how / what its doing...?
CREATE TABLE #MyTempTable(LocalUpdateID INT)
INSERT INTO #MyTempTable EXECUTE spGetObsoleteUpdatesToCleanup SELECT * FROM #MyTempTable GO DECLARE @MyUpdateID int DECLARE MyCur CURSOR FOR SELECT LocalUpdateID FROM #MyTempTable OPEN MyCur FETCH NEXT FROM MyCur INTO @MyUpdateID WHILE @@FETCH_STATUS = 0 BEGIN exec spDeleteUpdate @localUpdateID=@MyUpdateID FETCH NEXT FROM MyCur INTO @MyUpdateID END CLOSE MyCur DEALLOCATE MyCur