我需要在執行之前SqlBulkCopy
授予db_datawriter
之後將其刪除:哪一項權利授予用戶在SQL 2008中授予他人權利的權利?
try
{
"EXEC [db_mod].[sys].[sp_addrolemember] N'db_datawriter', N'my_user'" // via SqlCommand
bulk.WriteToServer(table);
}
finally
{
"EXEC [db_mod].[sys].[sp_droprolemember] N'db_datawriter', N'my_user'" // via another SqlCommand
}
,但我得到一個錯誤:
User does not have permission to perform this action.
我該如何解決呢?