Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'CREATE TABLE permission denied in database' despite using 'UseTempDB' #125

Closed
cmCJP opened this issue Jan 2, 2019 · 3 comments
Closed
Labels

Comments

@cmCJP
Copy link

cmCJP commented Jan 2, 2019

The agent account does not have table permissions. The same code is executed elsewhere, but with different models. The only notable difference is the second model contains a discriminator.

Despite setting the "BulkConfig":

        public void Execute(IList<GroupPupil> Model)//this works
        {
            var now = DateTime.UtcNow;
            Context.BulkInsertOrUpdate(Model.Where(a => a.End == DateTime.MaxValue).ToList(), new BulkConfig { UseTempDB = true });
            Context.BulkDelete(Model.Where(a => a.End < DateTime.MaxValue).ToList(), new BulkConfig { UseTempDB = true });
        }

        public void Execute(IList<Pupil> Model)//this fails
        {
            var now = DateTime.UtcNow;
            Context.BulkInsertOrUpdate(Model, new BulkConfig { UseTempDB = true });
        }

Non-temp table is created and insert fails:

SELECT TOP 0 T.[Id], T.[Discriminator], T.[GivenName], T.[Guid], T.[PreferredName], T.[SourceType], T.[Surname] INTO [Organisation].[PersonTemp280004e2] FROM [Organisation].[Person] AS T LEFT JOIN [Organisation].[Person] AS Source ON 1 = 0;

Using Latest - 2.3.6

Any advice?

@cmCJP cmCJP changed the title : 'CREATE TABLE permission denied in database' despite using 'UseTempDB' 'CREATE TABLE permission denied in database' despite using 'UseTempDB' Jan 2, 2019
@borisdj
Copy link
Owner

borisdj commented Jan 3, 2019

There is remark about this in README:

UseTempDB when set then BulkOperation has to be inside Transaction.

@cmCJP
Copy link
Author

cmCJP commented Jan 4, 2019

Thanks, my bad. Great library though.

@borisdj
Copy link
Owner

borisdj commented Jan 4, 2019

You are welcome. Glad it was useful.

@borisdj borisdj closed this as completed Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants