{"id":3363,"date":"2020-07-29T22:12:10","date_gmt":"2020-07-29T20:12:10","guid":{"rendered":"http:\/\/van-maanen.com\/?p=3363"},"modified":"2020-07-29T22:12:10","modified_gmt":"2020-07-29T20:12:10","slug":"granting-privs-in-sql-server","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=3363","title":{"rendered":"Granting privs in SQL Server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Granting privs in SQL Server is done in three steps. As first step, one must create a login to the SQL Server. This can be seen as getting the entrance to the data fort.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">CREATE LOGIN lezer\nWITH PASSWORD = 'password'\nGO<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">One must then get entrance to the database. One must create a user who has access to the system files that steer the database.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">use master\nCREATE USER lezer\nFOR LOGIN lezer\nWITH DEFAULT_SCHEMA =dbo<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Subsequently, a user is created on the database itsself.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">use [sqlservertomvanmaanen]<br>CREATE USER lezer<br>FOR LOGIN lezer<br>WITH DEFAULT_SCHEMA =dbo<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then a role is created that provides a pattern of privs that is given to a user. A user is then added as a member to that role.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">CREATE ROLE [db_Lezer]<br>ALTER ROLE [db_Lezer] ADD MEMBER lezer<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, privs are granted to the role.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">GRANT CREATE FUNCTION TO [db_Lezer]<br>GRANT CREATE PROCEDURE TO [db_Lezer]<br>GRANT CREATE SCHEMA TO [db_Lezer]<br>GRANT CREATE SYNONYM TO [db_Lezer]<br>GRANT CREATE TABLE TO [db_Lezer]<br>GRANT CREATE VIEW TO [db_Lezer]<br>GRANT DELETE TO [db_Lezer]<br>GRANT EXECUTE TO [db_Lezer]<br>GRANT INSERT TO [db_Lezer]<br>GRANT REFERENCES TO [db_Lezer]<br>GRANT SELECT TO [db_Lezer]<br>GRANT SHOWPLAN TO [db_Lezer]<br>GRANT UPDATE TO [db_Lezer]<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Granting privs in SQL Server is done in three steps. As first step, one must create a login to the SQL Server. This can be seen as getting the entrance to the data fort. CREATE LOGIN lezer WITH PASSWORD = &#8216;password&#8217; GO One must then get entrance to the database. One must create a user [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3363","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3363"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3363\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3363"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}