I have created database project using VS 2012. Once the schema comparison is done, the update target button should be enabled to sync with target.
But it's not getting enabled. Any help plz.
I'm using VS 2012 with sp 3, SQL Server 2012,
Check the Error List if you have any error, I had a non recognized word in VS (but it did in SQL Server), I commented it out, re-compared and it was enabled successfully.
See if you have a "warning" message stating "Cannot generate deployment plan due to an internal error". If so, the Update and Generate Script buttons will be disabled.
Close Visual Studio, navigate to the folder containing the Database project and remove all (*.dbmdl) files. Then restart Visual Studio, re-run the compare schema at which point the Update button should be enabled.
Workaround:
In my case. Fixing Error was not priority task. Also i was not able to find any Error in Error List.
Its just you dont have to use your "Visual Studio Database Project" in source or target. Instead of using project, create a temp DataBase using script already with you.
Select this (or these) temp database(s) in source and (or) other in target.
Button must be Enabled.
For me getting difference was far more important than fixing the issue. Hope it helps you. With some more improvisation.
It seems your database project has sqlcmd variables without default values.
See:
http://www.andrewburrow.net/vs2012-schema-compare-buttons-disabled/
Hope this helps.
I couldn't see any errors in Error List, but I could see the errors in the Output tab
the everytime you open the "options" on "schema comparison" you must click on "compare" button again to activate the "update" button. However if it doesn't work at the first time, just close and reopen the Schema comparison file again.
For me, there were no errors visible in the Error List. This was because I had the "Show Issues Generated" drop down was set to "Build Only"; changing it to "Build + IntelliSense" allowed me to see the SQL errors that needed to be fixed to enable the Generate Script and Update buttons.
In SSDT I had the case where the update button was enabled but the generate script was not enabled. This was because my destination schema was my local solution (the *.sqlproj vs project).
It took a few minutes to dawn on me that the destination needed to be a real database to correctly generate the script.
And after all, when you have the available Update Target button and the disabled Generate Script button.
See if your source is a database and your target is your SSDT project.
If so then click "Switch source and target" button.
The Generate Script button will become available.
I.e. a SSDT project must be the source and a database must be the target in the Schema Compare window.
Workaround 2:
In my case, the Update button was greyed out because of there were errors warnings about a view that I created and added to the project earlier.
The problem was that the view was scripted to use full database qualified object naming. E.g. [databasename].[schemaname].[objectname], which works fine in SSMS, but causes a problem when it is checked in a DB Project.
If you use three part naming for referring an object in same DB project results in a error/warning in Visual Studio.
By changing the code to [schemaname].[objectname] in the definicion of the view removed the error warnings and enable the Update option. Happy days!
Credits:
https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/3577074-allow-three-part-naming-for-referring-a-db-object
https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/17396128-keep-update-and-generate-update-script-buttons
Typically the update button is grayed out when the database objects are available in the separate sql files physically inside the database project but are not included in the database project itself. I simply added those sql scripts into the project and the update button got enabled after comparing the schema.
In my case, the Update button was disabled because there was a scalar function that was modified and that function was used in a computed column definition.
My solution was to:
Manually drop the computed column(s) in the database
ALTER TABLE <your table> DROP COLUMN <your computed column>
Re-run the schema compare
The Update button was enabled, and the update completed successfully
I'm trying out Visual Studio 2012 and so far it's good but I created database project, added database *.mdf file to my App_Data and tried to create simple database with relations and I have no clue what to do next. I can't even name my database.
http://msdn.microsoft.com/en-us/library/hh272680(v=vs.103).aspx - AFAIK this article shows how to add relations but I can't find any Foreign Keys node. And also, why can't I edit name? VS2010 database management was so easy and intuitive, now I don't understand how to work with it.
More visual representation of my question and my simple table for example.
Table name you can change in Properties window:
relations by right clicking on Foreign Keys:
You can also modify sql in lower pane - all changes will be reflected in graphical tools. I'm find this useful e.g. when I want to copy some columns from one table to another.
You can also make changes on database with another tools, like SSMS (better FK tools I think) and then import this changes via Schema Compare by setting database as source and project as destination.
Right click on the database where you like to execute the query and then select add new query and execute the following query in it.
sp_rename 'oldtablename','newtablename'
Not so far. Right clic on this element.
check out this answer: Visual Studio 2012 Database Designer - Has the functionality changed?
I'm new to sql anyway if you right click the toolbar there is a "table designer" set of buttons but are all grayed out. Not sure if to initiate them the db must be Online.
I need to migrate Work Items from one TFS server to another TFS server. I tried migrating them using the TFSMigration tool available in CodePlex.
The problem I am encountering is the schema for the work item on the source TFS is different from the schema of the work item type on destination. I don't want the destination TFS server schema for the work item to be modified. The change in schema is one new column only, but still don't want to take that change.
In one blog it was said that we can do that using Excel but not much details were available. I am not sure we can even use Excel to migrate the entire history related to Excel.
Have a look at the TFS Integration Tools on VS gallery. This supports custom field mappings as part of a migration, documentation here (direct download).
I did this a while back and, not finding an appropriate tool, resorted to copying the title and description etc across manually, as we only had a few active work items at the time, so it only took about an hour.
however, if I need to do it again, I'll use the TFS API to read fields of interest and write them to the new database. that way any schema differences don't matter, and the process is automated but under your control. Search for studying work items with the TFS API for details - it's really very easy.
Of course with both of these approaches (and all the migration tools AFAIK) you will only get a snapshot of the data - all history will be lost (or at best you can query using AsOf to get historical data, but all the entries you make will be timestamped at the moment you write them, not with the historical time that the event originally occurred.)
You can use the Excel editor to edit the source query All Items "Open Query in Microsoft Excel". Then open the destination query All Items "Open Query in Microsoft Excel". Copy and paste the contents from one excel window to the other. Certain fields like attachments will not transfer.
I am using FMDB in my app to do some updates in my DB. Problem is when I update my table with executeUpdate function, it update my table BUT if I copy the same .sqlite file from project to at another place in my drive and try to query using terminal, it shows that database is not updated, why it is so?
Well, you program will never change the database you copied into your xcode-project. When you compile your program the sqlite database is copied into your app binary. If you would like to examine your resulting database you have to reveal your binary used by the iPhone Simulator.
I am using SubSonic version 2.2 to generate a script of my database using the /version command. Recently, I needed to generate a script for a database which is set to French collation and running on a French OS. The script fails because there are several columns which are of datatype "float" which use a comma instead of a period. (2,3 instead of 2.3). When I try to execute the sql script to re-import the data this causes an error. (column mismatch as the db engine thinks I am trying to insert too many columns). Is there any way to get the /version command to support internationalization? Is this supported in version 3? Modifying the original data is not an option unfortunately.
Thanks in advance.
Probably for this issue your best bet is to use Visual Studio and right-click on your DB selecting "Publish To Provider" - this generates the scripts for you (data too).
Sort of stuck on this one and no - 3.0 doesn't address this.