Reputation:
When ever I try to execute the following I get
Msg 195, Level 15, State 10, Line 1 'dbname' is not a recognized built-in function name.
USE Personnel
GO
SELECT has_perms_by_name(dbname(), 'OBJECT', 'SELECT') as Have_Select,
* from sys.tables;
GO
I'm not sure if dbname() should be got replaced or if its a syntax error.
Upvotes: 1
Views: 1080
Reputation: 3788
You probably want the following which I've confirmed works:
USE Personnel
GO
SELECT has_perms_by_name(DB_NAME(), 'OBJECT', 'SELECT') as Have_Select,
* from sys.tables;
GO
And as per a comment it's not case-sensitive, the problem was the missing underscore.
Upvotes: 3