C# Microsoft SQL Server 2012 GRANT syntax -
i have question grant syntax me specific scenario.
i have created database instance name : myinstance db called: mydb
i have run sql command makes new table, , want grant select , update privileges user.
i using connection string follows integrated security turned on :
data source=.\\myinstance;initial catalog=mydb;integrated security=true
the grant syntax trying alter is:
sqlcommand = new sqlcommand( @"grant select, update on tblunits [inet_account]", sqlconnection); sqlcommand.executenonquery();
now database owner : andy-pc\andy wondering replace [inet_account] current setup?
as may know [inet_account] refers principal permission being granted. updating user requiring select access table. following syntax grant msdn:
grant <permission> [ ,...n ] on [ object :: ][ schema_name ]. object_name [ ( column [ ,...n ] ) ] <database_principal> [ ,...n ] [ grant option ] [ <database_principal> ] <permission> ::= [ privileges ] | permission [ ( column [ ,...n ] ) ] <database_principal> ::= database_user | database_role | application_role | database_user_mapped_to_windows_user | database_user_mapped_to_windows_group | database_user_mapped_to_certificate | database_user_mapped_to_asymmetric_key | database_user_with_no_login
.
Comments
Post a Comment