I am kind of new to SQL. I have lots of experience with Selects and Inserts and all that jazz, but this is the first time I have had to push beyond that. I am trying to Revoke all public rights to a database in SQL. I keep encountering two errors my revoke statement
REVOKE SELECT ON @ObjectName To public
wont take unless I put an object name in place of my variable.
The second error is comes from trying to pull an object out of a temporary database the SELECT statement is working but it keeps telling me it cant convert the Object from an NVARCHAR to an int. I understand this which is why I declared my variable as an NVARCHAR in the first place so why is it trying to convert into an int? Here is some example code
DECLARE @ObjectName NvarChar(30)
SELECT @ObjectName = (SELECT Rand(Object) FROM TempTable)
If anyone can tell me what is going on I would be much obliged!