When I used sqlserver today, I found a problem, that is, using the insertinto database name. dbo. when a statement such as table name (field) values (value) returns an error: the sqlserver server subject cannot access the database in the current security context. So I found some information on the Internet and found that the trustworthy database attribute is used to specify
When I used sqlserver today, I found a problem, that is, using the insert into database name. dbo. when a statement such as table name (field) values (value) returns an error: the sqlserver server subject cannot access the database in the current security context. So I found some information on the Internet and found that the trustworthy database attribute is used to specify
When SQL Server is used today, an error is returned when the insert into database name. dbo. Table Name (field) values (value) statement is used:
The server subject cannot access the database in the current security context.
So I found some information on the Internet and found that the trustworthy database attribute is used to indicate whether the SQL Server instance trusts the database and its content. By default, this setting is OFF, but you can use the alter database statement to set it to ON.
To view which databases have the trustworthy attribute enabled, run the following command:
SELECT name, database_id, is_trustworthy_on FROM sys. databases, Which is enabled by msdb by default.
To open the database trustworthy attribute, run the following command:
Alter database name SET TRUSTWORTHY ON
To authorize a user access, run the following command:
Alter authorization on database: DATABASE name TO [user name]