I already tried that and below is what I did :



declare @Database_Name nVarchar(512)
declare Database_Cursor cursor
for

select name from sys.databases
where name not in ('master','model','msdb','tempdb')
and state_desc like 'online'


open Database_Cursor
fetch next from Database_Cursor
into @Database_Name
while @@fetch_status = 0
begin

Use @Database_Name
go;
sp_msforeachtable 'ALTER INDEX all ON ?
SET (
ALLOW_PAGE_LOCKS = ON
)
'

if @@error <> 0
break

fetch next from Database_Cursor
into @Database_Name
end
close Database_Cursor
deallocate Database_Cursor


and this gives an error:

Msg 102, Level 15, State 1, Line 17
Incorrect syntax near '@Database_Name'.



where am I wrong?? I am sorry but I am novice when it comes to all this..