Sql 2008 Management Tools: Can't save changes that require Recreation of Database
Ah here's a silly new default in SQL Server's Management Tools: When you design a table in a database and then try to make a change to a table structure that requires the table to be recreated, the management tools will not allow you to save the changes. Instead you'll be greeted by this friendly dialog:
Notice that there's no option to save the changes - it's a hard rule that is applied upon saving and you can get past this other than back out of the dialog.
My first thought here is "Crap! Now what?" and off I go searching for an option to turn this off. Eventually I find a solution after a quick search online. As it turns out it's just an annoying configuration default setting that can be easily changed, but if you're like me and you spend a while searching around the Management Tools and finding nothing initially, I ended up eventually backing out of my initial database changes and losing a bit of work in the process. It wasn't until a bit later that I found the setting to change.
Hopefully you'll find this entry before you back out of database changes - you can get out of the above dialog, make the settings change and then still go ahead and save changes to your database.
The fix is: Go to Tools | Options | Designers | Tables and Designers and uncheck the Prevent Saving Changes that require table re-creation option:
and that does the trick.
This is a pretty harsh change IMHO. While I think it's a good idea that the tools now detect table recreation changes and can notify you, I think the better option by far would have been to pop up that initial dialog with a warning message AND provide an option on the buttons to either go forward or abort. Instead this arcane switch is going to cause some pause for most people familiar with the old tool behavior. It's not like this option is easy to find - I looked in the database options before I finally found it in the global tool options.
As it is, reverting back to the 'old' behavior now doesn't let you know that a table recreate is required either, so the behavior now is the same as was with the old tools. Here Microsoft added some useful functionality and then UI fails to expose it intelligently...
The Voices of Reason
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
pamela
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
i agree with xun ding. hopefully that march will now stop for a while with 2008.
@xun ding: but now we have date AND time datatyp and tablenames as parameters.
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
anyway, thanks rick!
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
Kiddin' THANK YOU SO MUCH!!!
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
Is this telling me that we have taken a MASSIVE step backwards and can now not make changes to a table on the fly without loosing data!!??? Good god that's horrible... I make changes to indexes, fields etc. etc. all the time on live databases... because I live in the real world.
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
this is one of those little devils that can drive you crazy,
lucky i was to found your post on my first search,
cheers
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
I've posted MS SQL feedback suggestion https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=432179
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
I agree that it would be nice if this tool just did what you want ... perfectly.
I also think it would be nice if it presented a nicer dialog experience. Prompting you to permit it to change or move back.
But.
You should be aware that this tool was far from perfect in earlier versions. It did cause people to lose data. Especially bad on production systems.
This change was not bug, nor was the decision made without a lot of thought. But it was in response to a "Dammed if you do, dammed if you don't" conundrum. People who had lost data were asking "Why didn't MS protect me", but the same people had issues understanding that you can't change a nullable column to "NOT NULL" if it has data & there is no DEFAULT value.
No doubt you are aware that the changes that many people want to make are often far from trivial. Many can't be achieved by a simple ALTER statement. To do it correctly & to preserve data is often quite tricky. Some operations would require creating of TEMP tables to drop & recreate the objects in the new form. Perhaps needing a strict order of other ALTER statements to satisfy other pre-reqs (eg: FK constraints). Even when your change can be done with an ALTER stmts, it may require a table lock. Preventing access to your production system for an extended period of time while the DDL statement changed all rows in a huge table, checking the constraints & Foreign keys.
Yes, the SQL team know they need to invest more effort to improve this area.
A tool that does offer a safer "Production level" change experience is "Microsoft® Visual Studio Team System 2008 Database Edition" it can compare the delta between the original schema & your new schema & will emit scripts to make the changes you need. You can then review it & decide if that is something you'll run now or after hours.
Hope this helps you to understand there are risks in changing this option & hacking away on any system with data in it.
Dave
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
And if the changes don't work it will fail which personally I think is a better behavior (works when it can, fails when it can) than just not doing it at all.
I think we agree better dialogs would help here. Ideally an option - go ahead do it anyway should be there.
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
I was getting this error when adding a column (not sure why this requires recreation of the table)?
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
Can someone comment on what changes are protected by this option that DO cause you to loose data? (Apart from the obvious shrinking the size of a field.)
Thanks
Pieter
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
thanks
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
It's really helpful, you saved me from jumping between SQL 2005 and SQL 2008 IDE. You rock!
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
:) David
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
Searched sysobjects and it does not exist - But I can not create the table again.
Can anyone point me in the right direction?
Thanks!!
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
Turns a really annoying problem into a quick fix !
Now if Microsoft could have flagged that settings location in the error code !
What fun would that be......?
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
Regards,
Amjad Khan
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database
That's like the 20th time over the past several years that your blog has helped me out. Kudos and thanks amigo.
Jack
# re: Sql 2008 Management Tools: Can't save changes that require Recreation of Database