Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm creating a bacpac file from a local database for import to Azure SQL Server, but I keep getting an error which I cannot seem to resolve.

Error SQL71564: Element Primary Key has an unsupported property DoAllowRowLocks set and is not supported
    when used as part of a data package. 
Error SQL71564: Element Primary Key has an unsupported property DoAllowPageLocks set and is not supported
    when used as part of a data package.

And this error repeats itself for 50 more keys. I have been focussing on this problem for 2 days fulltime now, and I would really like some help on this issue.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I have fixed the problems using these script:

[Rebuild all indexes]

USE AdventureWorks;
declare @table_name varchar(200)
declare @SQL varchar(300)

DECLARE vendor_cursor cursor 
        FOR SELECT sys.tables.name
        FROM sys.tables WHERE sys.tables.name NOT LIKE '%_dss'
OPEN vendor_cursor

FETCH NEXT FROM vendor_cursor 
INTO @table_name

WHILE @@FETCH_STATUS = 0
BEGIN
 SELECT @SQL =  'ALTER INDEX ALL ON '+@table_name+' REBUILD';
 EXEC(@SQL);
 print 'INDEX Rebuild on all indexes in table '+@table_name+' is done.';
 FETCH NEXT FROM vendor_cursor  INTO @table_name
END 
CLOSE vendor_cursor;
DEALLOCATE vendor_cursor;
GO

I also needed to change the IsNotForReplication property. This script turns it YES for all tables that have an identity column.

EXEC sp_msforeachtable @command1 = '
declare @int int
set @int =object_id("?")
EXEC sys.sp_identitycolumnforreplication @int, 1'

This script turns it NO for all tables that have an identity column.

EXEC sp_msforeachtable @command1 = ‘
declare @int int
set @int =object_id(“?”)
EXEC sys.sp_identitycolumnforreplication @int, 0′
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.