sqlsql-server

The SELECT permission was denied


My query:

update sc 
set grade = 80
where grade = 90

results in this error:

Msg 229, Level 14, State 5, Line 1
The SELECT permission was denied on the object 'sc', database 'student', schema 'dbo'.

How can I fix it?


Solution

  • I figured it out.

    My query:

    update sc 
    set grade = 80
    where grade = 90
    

    I need permission to update and select, so I need to modify to

    update sc
    set grate = 80
    

    or

    grant UPDATE,SELECT (grade) on sc to MyUserName