The argument to callproc needs to be a list of parameters. Therefore, if you pass in
It will split the string. Instead use:
When non sysadmins execute the SP everything works except for adding
users to the database roles with error: Cannot alter the role
'db_datareader', because it does not exist or you do not have
According to the ALTER ROLE documentation:
Additionally, to change the membership in a fixed database role you
Membership in the db_owner fixed ...
You can't get the original source back. DBA_SOURCE, ALL_SOURCE, and USER_SOURCE are data dictionary views. So you can do something like
select line, text
where name = 'GET_OS_USER'
and type = 'FUNCTION';
That will show you the wrapped text of the function. But the point of wrapping your source code is to prevent users that have ...
Check what the default database for that login is, and on the job, in which database the job is set to run. If it is a member of sysadmin, the only way it can fail to login is if the login is disabled, if the default database or database specified in the connection attempt does not exist (or is not online, or set to single user), or if rights to the default ...
Please add more details.
I assume T-SQL job step type here. If you use something else (cmdexec, SSIS, Powershell), then let us know.
Agent service account is always sysadmin with the connection it uses to SQL Server.
A job owned by a sysadmin will result in that Agent by default will execute as itself, i.e., sysadmin.
A sysadmin can do everything, everywhere....
The probable reason I can think is when u execute manually it might be because you are executing with login with privileges or access to execute that proc.
However sql agent job might be using the account assigned to run sql agent services.
Hence you see the error for login failed.
Probably check the error log when failure happens to get more details on that ...
You can get information about the views from INFORMATION_SCHEMA.VIEWS
SELECT TABLE_SCHEMA, TABLE_NAME, VIEW_DEFINITION
If you want to place the view in another schema (database in MySQL), replace TABLE_SCHEMA above.