Visual Studio 2010 - How can I control the order of schema updates when using schema compare? - visual-studio-2010

I've been attempting to use Visual Studio 2010 schema compare to take updates from a Dev database and move it to a UAT environment.
The compare itself works fine, but the tool continually orders the update scripts incorrectly.
It will try to update a stored procedure first, then the view that the procedure depends on. If my view includes new fields that the procedure depends on, then it will fail the update.
I've attempted to force the dependency to be recognised by qualifying all references to the dependent views with the schema name (essentially dbo.view rather than view), as suggested in http://msdn.microsoft.com/en-us/library/aa833294.aspx
Is there any way to force the scripts to a particular order (tables, views then sprocs), or is there a way to tell how and why the dependencies are calculated so I can see what's going wrong?

I don't think that either of the things I was hoping to do are possible.
What I have learnt is that the refresh on the schema compare doesn't always seem to recalculate dependencies correctly.
Closing it and starting a new one worked, just refreshing the original didn't.

Related

Why does Visual Studio deploy two separate SSAS tabular models

So I've created a 2017 SSAS tabular model in VS. I've then deployed it to the SSAS tab work space server. But for some reason it creates two separate models. One normal and one with some random characters appended to it. Worse still, when I deploy changes to the model, it only updates the one with the characters appended.
What is going on here?
Deployment setting:
Two models showing in the work space server:
The tabular model with your username and a GUID is the workspace database. This is a local copy of the tabular model with the changes that you've applied to it when Integrated Workspace mode is not used. The workspace database is kept in memory while it's open in SSDT, and depending on the Workspace Retention property may be either removed from memory, removed from memory/disk, or still kept in memory. The default setting is to remove it from memory but not from disk, hence why you may not see this database whenever you close the model in SSDT. This property can by accessed from SSDT by highlighting the .bim file and viewing the properties (press F4).
The changes made to the workspace database should be applied to the deployed model when it's deployed using the model name as the target database on the deployment server, as in your screenshot. When you examine the model (non-workspace database) in SSMS, how do you know the changes are not applied to this, and have you tried refreshing the view from SSMS? This can be done by right-clocking the Database folder above the tabular models and pressing Refresh. Also, the deployment SSDT is succeeding without errors, correct?
Since I cannot comment on the correct answer I'll make it a separate answer.
What I saw happening was when you import a cube in Visual Studio (while creating a new project) a new tabular DB is created with the name "CubeName_username_Guid".
Everything you modify gets deployed to the real cube after you close Visual Studio. Also after you close VS, the oddly named cube also disappears.
I hope it helps.

Bug in Fuzzy Lookup in Visual Studio SSIS

I'm using Visual Studio Pro 2013 and want to use the Fuzzy Lookup task but there seems to be a bug that prevents the component from connecting to the reference tables.
A reference file and table is specified in the Connection tab which all seems fine but the Columns tab is also needed to create the reference links between different fields of the data however there is nothing there:
The error messages are as follows:
I've read elsewhere this was a known bug on older versions of SSIS from about 2005 - anyone know what the problem is here and how I can fix this?
I should add that the connection manager and the table seem fine as they have been used many times elsewhere in the project. I've tried recreating the data flow in a new document and even restarting my PC but this simply won't work. I should add that I've not used the Fuzzy Lookup before but have looked at several references and know that the column tab should be populated with data and not be an issue.
Many Thanks,
Kw
Not a bug, it's how the product works. From the manual, it specifies the reference table must be a table in sql server. A table in Access, therefore, is unsuitable for use in the fuzzy lookup component.
The transformation needs access to a reference data source that contains the values that are used to clean and extend the input data. The reference data source must be a table in a SQL Server database

Is it possible to update a SSDT DB project from a database?

We have two software projects that both communicate with a single database. Right now SQL updates are all done on the database and it's relying on developers to make sure to update both sets of projects independently to use the latest database model. Making these matters worse both projects are in separate solutions in separate source control repositories.
While I acknowledge this is a terrible situation to be in, I inherited this situation, and while my long term goal is to consolidate and share the (lots) of duplicated logic between them in one common project shared among both sets of application for various reasons it is not feasible to jump right into that right now due to critical deadlines coming up and the need to combine them iteratively and schedule it with other developers to not disrupt work too much.
Keeping that in mind, I really want to use SSDT to at least start bringing the database structure under source control and make it easier to manage, as there are quite a few database changes that I'm about to do.
The problem with SSDT in this scenario is that you can only import from database once. After that the option is greyed out and unavailable, which is apparently a design decision of SSDT, since it's explicitly listed in the MSDN documentation.
Is there any easy way to update my SSDT project without nuking the current project and recreating it each time someone makes a change to the database structure?
Firstly your right, it is a horrible situation so work on improving it in the long term!
There are two things you can do, firstly you could use SSMS "Generate Scripts" to export all the objects and then use the import in SSDT to import from the scripts - this isn't greyed out.
The second thing you can do is manually bring the changes in using the schema compare in SSDT, you can set the database as the source and project as the destination and choose what you drop, update and import.
Ed
its bit delay in answer. I am using VS2017 Database project in which I have achieved this task by comparing a local database with database project once the comparison is over you can update the database by update button
Step 1 right click on the database project and click on schema compare item.
Step 2 select target -> select database connection option
Step 3 change source and target
Review Screenshots for more detail
I am going with compare solution :
Choose schema compare and make your database as a source and database project as a target then compare and update
see the this answer
Make a new temp Database project (outside of TFS) and import all the objects.
Checkout the Database project (inside TFS) and copy and paste all the folders (excluding BIN, OBJ folders) from the new temp Database Project into the Database Project (in TFS) and check in. This was way you get the latest DB object into TFS without duplicating.
If you expect new files in the copy/paste operation, then the new files should be included in the DB Project.
Delete the temp Database project folder.
You will need to do the process whenever you want to update all DB Objects into TFS.
This is a workaround which worked for me for this file duplicating issue.

ODAC/Entity Framework Model Update Issues

We are looking to introduce odac into our application but I am running into a number of issues and I can't seem to find any solutions that fix our issues.
We are using an oracle database and trying to use ODAC 12c Release 1 (12.1.0.1.0) with Oracle Developer Tools for Visual Studio.
In our model we would like to have multiple schemas so we can perform cross schema queries. The schemas which we select in the filter for the database connection appear when we are creating the model. However when we try to update our model from the database only the default schema is visible. Sometimes this can be fixed by opening the relevant part of the database in Server Explorer in Visual Studio but this doesn't always work. This fix never works after we add multiple connection strings for the same model (depending on the location of the user will depend on which database the user gets directed to).
The next issue we are having is that we can't the return types of stored procedures to be auto-generate. I have tried to retrieve the column information but it is never able to retrieve the metadata. I have seen a few suggestions of modifying the stored procedures then getting the column information and reverting the stored procedures but this is something we would like to avoid. Also the suggestions don't seem to work on oracle databases (but that could be me, I don't have much experience with databases).
The final issue (this is a minor issue) is that I cannot figure out how to get the generate code to omit underscores from the classes/methods generated. This isn't a huge issue it is purely to make it easier migrating the code we have.

How do I deploy specific objects from a Visual Studio database project?

I have a Visual Studio 2010 database project and I'd like to do a partial deployment, i.e. of specified objects. Is this possible? The only options I can see are to either do a full deployment or stop after generating the script.
For example, I'm changing many tables and stored procs but not everything is 100% finished and I'd like to push out a specific stored procedure to my test database, including its permissions, etc.
I read a little bit about SQL Server Data Tools, which apparently supports this, but I'm not clear on whether I'd have to migrate my database project to use that instead (would also need the ok from team lead), or if it's simply a plugin that would allow extra functionality.
Check out Schema Comparisons. They allow you to select the objects you want to deploy. They are available without SQL Server Data Tools.
A "partial deployment" is actually a little dangerous. Consider that you will have just built your database project, your entire database project, complete with the table changes, and it has built with no errors or warnings (right?). Now you want to deploy just your stored procedure, into a database that does not have the table changes.
Your stored procedure got no errors or warnings in the context of all the changes. Are you sure it will get no errors or warnings without those changes?
You should consider a source control solution to this problem. Save a copy of your stored procedure, revert to a version of the code that matches the database you'll be deploying to, then make your stored procedure changes to that. When you deploy, you will be checking to see if the stored procedure makes sense in the context of the database you'll be deploying into.

Resources