Getting schema information for the database failed with the exception."500 is the max"

Опубликовано: 20 Февраль 2025
на канале: Tricks That Make you Smart
994
13

Create login harsha WITH PASSWORD = 'Passwordplz';
GO
Create USER harsha FOR LOGIN harsha;
GO
EXEC sp_addrolemember 'db_ddladmin', 'harsha';
GO

declare @n char(1)
set @n = char(10)
declare @tables nvarchar(max)

select @tables = CAST('' as nVarChar(MAX))+ isnull( @tables + @n, '' ) + 'DENY VIEW DEFINITION ON [' + schema_name(schema_id) + '].[' + name + '] TO [harsha];'
from sys.tables
order by name desc

exec sp_Executesql @tables
GO

GRANT VIEW DEFINITION ON [dbo].[table0] TO [harsha];

Don't forget to subscribe to our channel.
   / tricksthatmakesmart  
  / tricksthatmakeyousmart  
  / tricksthatmakeyousmart