Ver Mensaje Individual
  #8 (permalink)  
Antiguo 18/06/2013, 17:13
Avatar de Libras
Libras
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: En la hermosa perla de occidente
Mensajes: 7.412
Antigüedad: 18 años, 3 meses
Puntos: 774
Respuesta: Rol sql server 2008

primero creas el rol, despues le das permisos al rol sobre la base de datos que necesitas(sobre el schema del rol), despues creas un usuario que agregas al rol, algo asi :P

Código SQL:
Ver original
  1. USE [master]
  2. CREATE ROLE [dba]
  3. GO
  4. ALTER AUTHORIZATION ON SCHEMA::[db_accessadmin] TO [dba]
  5. GO
  6. USE [master]
  7. GO
  8. ALTER AUTHORIZATION ON SCHEMA::[db_securityadmin] TO [dba]
  9. GO
  10. USE [master]
  11. GO
  12. ALTER AUTHORIZATION ON SCHEMA::[db_owner] TO [dba]
  13. GO
  14. USE [master]
  15. GO
  16. ALTER AUTHORIZATION ON SCHEMA::[db_backupoperator] TO [dba]
  17. GO
  18. USE [master]
  19. GO
  20. ALTER AUTHORIZATION ON SCHEMA::[db_ddladmin] TO [dba]
  21. GO
  22. USE [master]
  23. GO
  24. USE [master]
  25. GO
  26. ALTER AUTHORIZATION ON SCHEMA::[db_datareader] TO [dba]
  27. GO
  28. USE [master]
  29. GO
  30. ALTER AUTHORIZATION ON SCHEMA::[db_datawriter] TO [dba]
  31. GO
  32.  
  33.  
  34. USE [master]
  35. GO
  36. CREATE LOGIN [libras] WITH PASSWORD=N'*******' MUST_CHANGE, DEFAULT_DATABASE=[testing], CHECK_EXPIRATION=ON, CHECK_POLICY=ON
  37. GO
  38. USE [testing]
  39. GO
  40. CREATE USER [Libras] FOR LOGIN [libras]
  41. GO
  42. USE [testing]
  43. GO
  44. EXEC sp_addrolemember N'dba', N'Libras'
  45. GO
  46.  
  47. USE [testing]
  48. GO
  49. GRANT UPDATE TO [dba]
  50. GO
  51. USE [testing]
  52. GO
  53. GRANT TAKE OWNERSHIP TO [dba]
  54. GO
  55. USE [testing]
  56. GO
  57. GRANT AUTHENTICATE TO [dba]
  58. GO
  59. USE [testing]
  60. GO
  61. GRANT CONNECT REPLICATION TO [dba]
  62. GO
  63. USE [testing]
  64. GO
  65. GRANT CONTROL TO [dba]
  66. GO
  67. USE [testing]
  68. GO
  69. GRANT BACKUP DATABASE TO [dba]
  70. GO
  71. USE [testing]
  72. GO
  73. GRANT CREATE AGGREGATE TO [dba]
  74. GO
  75. USE [testing]
  76. GO
  77. GRANT CREATE FULLTEXT CATALOG TO [dba]
  78. GO
  79. USE [testing]
  80. GO
  81. GRANT CREATE CERTIFICATE TO [dba]
  82. GO
  83. USE [testing]
  84. GO
  85. GRANT CREATE ASYMMETRIC KEY TO [dba]
  86. GO
  87. USE [testing]
  88. GO
  89. GRANT CREATE SYMMETRIC KEY TO [dba]
  90. GO
  91. USE [testing]
  92. GO
  93. GRANT CREATE QUEUE TO [dba]
  94. GO
  95. USE [testing]
  96. GO
  97. GRANT CREATE XML SCHEMA COLLECTION TO [dba]
  98. GO
  99. USE [testing]
  100. GO
  101. GRANT CREATE CONTRACT TO [dba]
  102. GO
  103. USE [testing]
  104. GO
  105. GRANT CREATE REMOTE SERVICE BINDING TO [dba]
  106. GO
  107. USE [testing]
  108. GO
  109. GRANT CREATE ASSEMBLY TO [dba]
  110. GO
  111. USE [testing]
  112. GO
  113. GRANT CREATE SCHEMA TO [dba]
  114. GO
  115. USE [testing]
  116. GO
  117. GRANT CREATE FUNCTION TO [dba]
  118. GO
  119. USE [testing]
  120. GO
  121. GRANT CREATE DATABASE DDL EVENT NOTIFICATION TO [dba]
  122. GO
  123. USE [testing]
  124. GO
  125. GRANT CREATE DEFAULT TO [dba]
  126. GO
  127. USE [testing]
  128. GO
  129. GRANT CREATE PROCEDURE TO [dba]
  130. GO
  131. USE [testing]
  132. GO
  133. GRANT CREATE RULE TO [dba]
  134. GO
  135. USE [testing]
  136. GO
  137. GRANT CREATE ROLE TO [dba]
  138. GO
  139. USE [testing]
  140. GO
  141. GRANT CREATE ROUTE TO [dba]
  142. GO
  143. USE [testing]
  144. GO
  145. GRANT CREATE SERVICE TO [dba]
  146. GO
  147. USE [testing]
  148. GO
  149. GRANT CREATE SYNONYM TO [dba]
  150. GO
  151. USE [testing]
  152. GO
  153. GRANT CREATE TABLE TO [dba]
  154. GO
  155. USE [testing]
  156. GO
  157. GRANT CREATE MESSAGE TYPE TO [dba]
  158. GO
  159. USE [testing]
  160. GO
  161. GRANT CREATE TYPE TO [dba]
  162. GO
  163. USE [testing]
  164. GO
  165. GRANT CREATE VIEW TO [dba]
  166. GO
  167. USE [testing]
  168. GO
  169. GRANT EXECUTE TO [dba]
  170. GO
  171. USE [testing]
  172. GO
  173. GRANT DELETE TO [dba]
  174. GO
  175. USE [testing]
  176. GO
  177. GRANT INSERT TO [dba]
  178. GO
  179. USE [testing]
  180. GO
  181. GRANT ALTER ANY DATABASE AUDIT TO [dba]
  182. GO
  183. USE [testing]
  184. GO
  185. GRANT ALTER ANY FULLTEXT CATALOG TO [dba]
  186. GO
  187. USE [testing]
  188. GO
  189. GRANT ALTER ANY CERTIFICATE TO [dba]
  190. GO
  191. USE [testing]
  192. GO
  193. GRANT ALTER ANY ASYMMETRIC KEY TO [dba]
  194. GO
  195. USE [testing]
  196. GO
  197. GRANT ALTER ANY SYMMETRIC KEY TO [dba]
  198. GO
  199. USE [testing]
  200. GO
  201. GRANT ALTER ANY CONTRACT TO [dba]
  202. GO
  203. USE [testing]
  204. GO
  205. GRANT ALTER ANY DATABASE DDL TRIGGER TO [dba]
  206. GO
  207. USE [testing]
  208. GO
  209. GRANT ALTER ANY REMOTE SERVICE BINDING TO [dba]
  210. GO
  211. USE [testing]
  212. GO
  213. GRANT ALTER ANY ASSEMBLY TO [dba]
  214. GO
  215. USE [testing]
  216. GO
  217. GRANT ALTER ANY DATASPACE TO [dba]
  218. GO
  219. USE [testing]
  220. GO
  221. GRANT ALTER ANY SCHEMA TO [dba]
  222. GO
  223. USE [testing]
  224. GO
  225. GRANT ALTER ANY DATABASE EVENT NOTIFICATION TO [dba]
  226. GO
  227. USE [testing]
  228. GO
  229. GRANT ALTER ANY APPLICATION ROLE TO [dba]
  230. GO
  231. USE [testing]
  232. GO
  233. GRANT ALTER ANY ROLE TO [dba]
  234. GO
  235. USE [testing]
  236. GO
  237. GRANT ALTER ANY ROUTE TO [dba]
  238. GO
  239. USE [testing]
  240. GO
  241. GRANT ALTER ANY SERVICE TO [dba]
  242. GO
  243. USE [testing]
  244. GO
  245. GRANT ALTER ANY MESSAGE TYPE TO [dba]
  246. GO
  247. USE [testing]
  248. GO
  249. GRANT ALTER ANY USER TO [dba]
  250. GO
  251. USE [testing]
  252. GO
  253. GRANT ALTER TO [dba]
  254. GO
  255. USE [testing]
  256. GO
  257. GRANT SHOWPLAN TO [dba]
  258. GO
  259. USE [testing]
  260. GO
  261. GRANT CHECKPOINT TO [dba]
  262. GO
  263. USE [testing]
  264. GO
  265. GRANT REFERENCES TO [dba]
  266. GO
  267. USE [testing]
  268. GO
  269. GRANT BACKUP LOG TO [dba]
  270. GO
  271. USE [testing]
  272. GO
  273. GRANT SELECT TO [dba]
  274. GO
  275. USE [testing]
  276. GO
  277. GRANT SUBSCRIBE QUERY NOTIFICATIONS TO [dba]
  278. GO
  279. USE [testing]
  280. GO
  281. GRANT VIEW DEFINITION TO [dba]
  282. GO
  283. USE [testing]
  284. GO
  285. GRANT VIEW DATABASE STATE TO [dba]
  286. GO
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me