I use db MS SQL Server and use a lot of views (for use with O / R mapper). A little annoying that I would like
- use schema binding
- scripted update (for deployment on servers and installation in version control system)
but the problem is that when I want, for example, add a column to the table, I must first discard all the views that reference this table, update the table, and then recreate the views, even if the views do not need to be updated otherwise. This makes my upgrade scripts much longer, and also, looking at the differences in the version control system, it's harder to see what the actual relevant change was.
Is there a better way to handle this?
I need to still be able to use simple and source-controlled sql updates. A code generator like the one included in SQL Server Management Studio will be useful, but I am having problems with SQL Server Management Studio because it tends to create code that does not specify names for some indexes or (by default) restrictions. But I want to have the same dbs when I run my scripts on different systems, including the names of all the flaws, etc., Therefore, I do not need to go through loops when updating these restrictions later.
So, perhaps a more sensible SQL code generator would be the solution?
Now my workflow:
- enter the operator
alter tablein the query editor - check to see if the error statement is "
cannot ALTER 'XXX' because it is being referenced by object 'YYY'". - SQL Server Managment Studio script me
create drop alter- ,
drop
, , , , schemabinding script ...