-
Originally Posted by theo2f
Just for the records...
Code:
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
EXECUTE('
USE ' + @Database_Name + '
PRINT ''Running on '' + DB_NAME() + ''...''
EXEC SP_MSFOREACHTABLE @command1= ''ALTER INDEX all ON ? SET ( ALLOW_PAGE_LOCKS = ON )''
PRINT ''OK!''
')
IF @@ERROR <> 0
BREAK
FETCH NEXT FROM Database_Cursor INTO @Database_Name
END
CLOSE Database_Cursor
DEALLOCATE Database_Cursor
Hi Theo2f, I tried your code to get page locking to work but it didn't seem to do anything. Maybe I'm putting the code in the wrong place. Where should I put this exactly?
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|