VS2013 – DB Project – Issues and Tips

Last updated: 2015-09-14

Issues

I’ve recently stumpled upon a couple of problems in a DB project in Visual Studio

1) Could not update DB with a script after Schema Compare.

Solution: Remove build errors.
In my case it was a matter of commenting out some users and permissions.

2) Could not build. Got error

System.MethodAccessException: Attempt by method ‘Microsoft.Data.Tools.Schema.Sql.Build.SqlTaskHost.OnCreateCustomSchemaData

Solution was: Install Latest SQL Server Data Tools (SSDT)
Download Latest SQL Server Data Tools
https://msdn.microsoft.com/en-us/library/mt204009.aspx

3) Schema Compare script gave “The default schema does not exist”

Solution was change your default schema to dbo:

ALTER USER [YOURDOMAIN\YOURUSERID] WITH DEFAULT_SCHEMA=[dbo]
GO

Tips

1) Ignore GRANTs in Schema Compare

Solution:

Unselect Permissions

Thanks to http://stackoverflow.com/users/65775/keith

2) Data compare with VS

– Tools – SQL Server – New data comparison – select DBs and compare

Above will only work if table schemas match.

If you have unselected Permissions like above, then schemas don’t match.

3) Export data script with SSMS

If above won’t work you can export data script with SSMS.

– RightClick DB – Tasks – Genrate Scrips – Next

– Select Specific DB objects – Select Tables – Next

– Advanced – General – Type of data to scripts: Data only – OK – Next – Finish

The End.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: