SSDT Schema Compare add blank lines to the schema files - sql-server

I am using Schema Compare feature in Visual Studio 2017 to compare a database with database project (.sqlproj).
If I apply some changes to the project it also adds blank lines to some of the schema files.
After some investigation I found that I'm not the only one facing this issue. From the number of upvotes I can guess that MS will not fix this issue soon.
Has anyone found any workaround for this?

Not really a workaround or a solution, but I remember having this issue on Visual Studio 2017 and the issue stopped arising when I upgraded to Visual Studio 2019.

You may want to check your error list in Visual Studio. There is a good chance that there are dependent objects (e.g. Users, Logins, Tables, Keys) that the object is dependent on and is missing and not synchronized. If you synchronized those missing object to your database project first it may resolve your issue.

Related

Visual Studio 2015 Error ( An incompatible SQL Server Version was detected )

i need you guys help. I added a SQL Server Database to my asp.net project. However when i try to create a new table in the database, the error "An incompatible SQL Server Version was detected" come up.
I tried looking up online for solution and install the SSDT for it however it still do not work. I checked under "Extension and Updates", Microsoft SQL Server Update is not stated there too so I don't know what is going on... please help me experts. Currently using visual studio 2015 community version.
Try this--though it is hard to explain, and the actual details/location of information may vary depending on version, edition, installation, language, phase of the moon, etc. etc.
No guarantee this is your problem, but it--or something similar--is possible.
Open the Properties for the database project
There should be a set of tabs or pages. One of these is "Project Settings"
There should be a dropdown labeled "Target platform
Set this to the version of SQL you have installed/are trying to support.
Attempting to attach a sample screen shot, below
Walking through that... I suspect this might not actually be your problem. Thing is, there are settings and switches similar to this in many places, and one of them is probably what you are looking for. Good luck!

SQL71501 - How to Suppress this Error

My team/company tried out SSDT for a few small projects and we were quite impressed.
Recently we investigated use of SSDT for one of our larger existing applications and got FLOODED with SQL71501 errors for external database references.
There is quite a web of database coupling for the application, so that is understandable.
Is there some way to suppress/disable/turn off this check so a SSDT project can build regardless of these unresolved references?
Most discussion on this Error Code incorrectly describe it as a warning, not an Error.
Visual Studio 2015 Enterprise - latest SSDT pack
SQL 2008
I was just about to cleanup a few of these in my solution after upgrading to a new version of sql server. I'm on VS2017 but I think this was the same.
If you have database projects in the solution already for the referenced databases, then you can just add database references to the project throwing the errors. If you already have these references, edit the reference properties and set Suppress Reference Warnings to true.
[EDIT: Suppress Reference Warnings seems to have no affect on invalid references.]
If you don't have database projects for the solutions, you will need to add them. You won't necessarily need to fill them in with all of the database object if you check the Suppress Reference Warnings box.
Good luck!
I had success with Visual Studio 2017 by adding the exact warning code against the file that was having the trouble, in my case it was "un resolved reference" I didnt want to add a reference to the master DB to my project.
Right click on File, Properties, Suppress TSql Warnings : 71502

How can I store my Microsoft SQL Database_Diagram inside SSDT project?

I'm using microsoft SQL Server Data Tools (SSDT), in my projects to try to keep everything in order.
I was wondering if anyone know how to store the Database Diagram into SSDT Project, in order to don't lose any work and keep this model updated with my team?
I tryed to compare it using schema, but it didn't exists.
I also couldn't find any Database Diagram in Visual studio 2013.
Am I wrong to try to use this model type? Are there better ways to do it?
Also, Is it possible to create Jobs throught SSDT?
Thank you very much,
The database diagrams are stored in internal tables so you could add their definitions and include the data in a post deploy script but you would end up deploying to all your environments which is unusual (I don't know your circumstance so I won't say wrong!).
Unless you particularly needed the diagrams in ssms I would look to something else, redgate have a database diagramming tool, I prefer to keep a copy of Visio 2010 pro to generate them, the vsd files can then be added to the project and shared between the team.
I assume it is to help document your databases but If you wanted the editing and designer support from diagrams you get that other ways with ssdt.
Re: jobs, there is no native object but you can create them in pre/post deploy scripts.

SSDT & redgate source control - how to link?

We currently have our database objects in TFS2012 and happily use redgate sql source control to check in & getlatest. So far this works great.
I now want to use SSDT in order to create a dacpac that defines the latest schema.
What I'm missing is how to link the SQL Server database project so that a check-in via redgate source control would ripple through to the database project (upon a getlatest) and therefore schema changes would be shown in the dacpac upon a recompile?
thanks
As it's 3+ months after I posted the question, and https://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/ I guess I should state what the outcome was...
We had a number of unresolved (at the time at least) issues automating SQL Compare, which was the reason for looking into SSDT in the first place. The more we looked at SSDT the more we became impressed with it (still has some issues, but doesn't everything?) to the extent that we have now dropped our use of redgate, therefore the need for SSDT to play nicely with redgate is no longer required.
This is not to say we're not a fan of Redgates products or that the answer is to drop redgates products - just that they didn't meet our requirements when our requirements changed (we started to automate everything).
I'll still be sending Redgate a Christmas card, honest :)
Here's a document describing how to use SQL Source Control and SQL Compare in conjunction with SSDT database projects. It's beta functionality, and we're aware of a few issues, but please report them to us (support#red-gate.com) so we can prioritize our backlog.

SQL Server Version control using TFS 2010 which syncs directly with the Development Server

We are planning to put out SQL Objects (Tables, StoredProcedures, UDF's and Views) under our existing TFS 2010 versio control.
Is is possible that any check-in's made to the objects under TFS version control gets automatically sync'd to our Development server. The technical team here are not so interested in having to make changes at 2 different places (Development Server + Check-in at TFS server). Its an overhead process change for them.
Late answer, but I hope it can be useful:
Recently, I've tried to find the solution for a similar problem, and I've bumped into a sql source control add-in for SSMS that works with the TFS, and I found some answers by reading this article:
SQL source control reduce database development time
I think it can be useful for you too (in case you couldn't solve your problem)
Hope I helped.
The best solution by far to do this is to use Red-Gate Source-Control. You will not find a better and easier product to do this, and all the other benefits you get from using it is huge. For example, it integrates 100% into SQL Management Studio.
You should use Visual Studio Database Projects. You'll get the best of both worlds! Source control and automated builds and deployment.
I found the solution to my unique scenario. I used the Sql server management studio project by using the TFS plugin for SSMS. Team can now easily make changes in the Development environment using SSMS and make check-ins at the same place. Nice and easy way to do things without additional overheads. However, this only solves the purpose of version control. I am still researching on how can we do schema compare and automated deployments using SSMS projects.

Resources