Role membership is managed in the transacted part of the scriptHello (again),<br/><br/>Sick of me yet? ;P<br/><br/>So, now it's time to start getting my other team mates to start using the database project.<br/><br/>I just had a very interesting thing happen. The short story is that when the &quot;Include transactional scripts&quot; deployment setting is enabled and &quot;Ignore role membership&quot; is disabled, then GDR sticks the EXECUTE sp_addrolemember @rolename = N'xxx', @membername = N'yyy' statements in the transaction part of the script even though this cannot be done inside a transaction (as management studio says if you try to run the generated deployment script).<br/><br/>Another bug?<br/><br/>Cheers,<br/>Steven© 2009 Microsoft Corporation. All rights reserved.Wed, 01 Jul 2009 05:24:56 Zd4e5cdae-3be0-4e2d-96c9-ec1444b85efahttp://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#d4e5cdae-3be0-4e2d-96c9-ec1444b85efahttp://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#d4e5cdae-3be0-4e2d-96c9-ec1444b85efaTheBeardedLlamahttp://social.msdn.microsoft.com/Profile/en-US/?user=TheBeardedLlamaRole membership is managed in the transacted part of the scriptHello (again),<br/><br/>Sick of me yet? ;P<br/><br/>So, now it's time to start getting my other team mates to start using the database project.<br/><br/>I just had a very interesting thing happen. The short story is that when the &quot;Include transactional scripts&quot; deployment setting is enabled and &quot;Ignore role membership&quot; is disabled, then GDR sticks the EXECUTE sp_addrolemember @rolename = N'xxx', @membername = N'yyy' statements in the transaction part of the script even though this cannot be done inside a transaction (as management studio says if you try to run the generated deployment script).<br/><br/>Another bug?<br/><br/>Cheers,<br/>StevenFri, 15 May 2009 16:00:30 Z2009-05-15T16:00:30Zhttp://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#9f668d33-ae2b-445c-bb98-7a430d2714b7http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#9f668d33-ae2b-445c-bb98-7a430d2714b7tomsmihttp://social.msdn.microsoft.com/Profile/en-US/?user=tomsmiRole membership is managed in the transacted part of the scriptHi Steven,<br/><br/>Based on my findings, it appears as though SQL server does allow role sp_addrolemember statements to be executed inside of a transaction.  What is the error you are getting when you try to deploy your script?  The error should be able to help me investigate further. <br/><br/>Thanks!<br/><br/>-Tom<br/><hr class="sig">Tom Smith, SDET - Microsoft Visual Studio Team Edition for Database ProfessionalsMon, 18 May 2009 20:36:02 Z2009-05-18T20:36:02Zhttp://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#4fcea710-376d-4eaf-98f3-8f4661600774http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#4fcea710-376d-4eaf-98f3-8f4661600774TheBeardedLlamahttp://social.msdn.microsoft.com/Profile/en-US/?user=TheBeardedLlamaRole membership is managed in the transacted part of the scriptHello Tom,<br/><br/>The script was run on SQL Server 2005 Developer edition. The error said that the sproc to add a role member cannot be run inside a transaction.<br/>I just had a thought: would the compatibility level affect this behaviour?<br/><br/>Cheers,<br/>StevenTue, 19 May 2009 08:36:36 Z2009-05-19T08:36:36Zhttp://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#9fd8df04-3f95-4651-8b80-05730d52498chttp://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#9fd8df04-3f95-4651-8b80-05730d52498ctomsmihttp://social.msdn.microsoft.com/Profile/en-US/?user=tomsmiRole membership is managed in the transacted part of the scriptHmmm...What compat level is your database?   Can you by chance send the sample deploy script that is failing?  Maybe I'm misisng something and don't have a deploy setting that matches yours?<br/><br/>Thanks!<br/>-Tom<br/><hr class="sig">Tom Smith, SDET - Microsoft Visual Studio Team Edition for Database ProfessionalsWed, 20 May 2009 00:53:40 Z2009-05-20T00:53:40Zhttp://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#68ccd79a-57c2-4899-a345-dd4153bf06f9http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#68ccd79a-57c2-4899-a345-dd4153bf06f9tomsmihttp://social.msdn.microsoft.com/Profile/en-US/?user=tomsmiRole membership is managed in the transacted part of the scriptDid some more investigating - are you by chance deploying to a SQL 2000 server?   Because a SQL 2000 server does get that error.  <br/><br/>Thanks,<br/>-Tom<br/><hr class="sig">Tom Smith, SDET - Microsoft Visual Studio Team Edition for Database ProfessionalsThu, 21 May 2009 21:06:35 Z2009-05-21T21:06:35Zhttp://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#ea96ef61-d8a1-4231-9089-67a624a7f27dhttp://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#ea96ef61-d8a1-4231-9089-67a624a7f27dTheBeardedLlamahttp://social.msdn.microsoft.com/Profile/en-US/?user=TheBeardedLlamaRole membership is managed in the transacted part of the scriptHello Tom,<br/>No I wasn't, but I have a strong suspicion that it had to do with the compatibility level and your comments have confirmed this.<br/>Sorry about the false alarm, but just in case anybody else gets stuck:<br/>Make sure that when you generate a script for SQL Server 2005 you are not deploying to SQL Server 2005 with the compatibility level set to SQL Server 2000.<br/><br/>Cheers,<br/>StevenFri, 22 May 2009 08:17:16 Z2009-05-22T08:17:16Zhttp://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#95bc26db-1691-4338-b939-0cc769e3f9b4http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/d4e5cdae-3be0-4e2d-96c9-ec1444b85efa#95bc26db-1691-4338-b939-0cc769e3f9b4snoopdiggyhttp://social.msdn.microsoft.com/Profile/en-US/?user=snoopdiggyRole membership is managed in the transacted part of the scriptAlthough this may be true for sp_addrolemember, it is NOT true for sp_droprolemember <div><br/></div> <div>VSTS Database GDR will try to execute sp_droprolemember within the transaction and an error message is produced:</div> <div><br/></div> <div>&quot;The procedure 'sys.sp_droprolemember' cannot be executed within a transaction.&quot;</div>Wed, 01 Jul 2009 05:24:56 Z2009-07-01T05:24:56Z