-- First, declare the variable @databasename

declare @databasename varchar(128)

-- Next declare the cursor to contain all databases with the
-- recovery model 1 (which is FULL) but not the systemdatabases

declare dbcursor CURSOR for
select name from master.sys.databases
where name not in ('master','tempdb','model','msdb')
and recovery_model=1

-- Open the cursor and put the databasename in to the @databasename
-- variable.

open dbcursor
fetch next from dbcursor into @databasename
while @@FETCH_STATUS = 0

-- Now run the code to change the database

alter database @databasename set recovery simple

-- When that is done, get the next name from the cursor until all
-- have been modified

fetch next from dbcursor into @databasename

-- Close and deallocate the cursor

close dbcursor
deallocate dbcursor