home recent topics recent posts search faq  

Huagati Systems Support Forum



register | lost password   open id sign in with Twitter
Messages in this topic - RSS

Home » Huagati DBML/EDMX Tools Support » nullability update on views may not be working?

Support forum for Huagati DBML/EDMX Tools
5/3/2010 10:45:33 PM

mkamoski
mkamoski
Posts: 46
I think the nullability update on views may not be working?
I changed the nullability in the underlying table from nullable to not-nullable.
I regenerated, with Huagati refresh from database.
The entity class was updated fine.
The consuming view, that used that table, was not updated, it seems.
What do you think?
0 permalink
5/4/2010 6:12:08 AM

Kristofer Andersson
Kristofer Andersson
Moderator
Posts: 331
Hi,

That is actually a SQL Server feature. Views will not change definition even if underlying tables do, so if changing a table column you also need to drop/recreate views that refer to it in order to change the view's definition.

The following T-SQL script illustrates this:

--create a test table with a nullable varchar(10) column
create table test_table (ttid uniqueidentifier not null, test_col varchar(10) null, constraint pk_test_table primary key (ttid));
go
--...create a view based on the test table...
create view ttview as select * from test_table
go
--change the column from a nullable varchar(10) to a non nullable varchar(20)
alter table test_table alter column test_col varchar(20) not null
go
--get the new table definition
sp_help test_table
go
--get the unchanged view definition
sp_help ttview
go


Best regards,
Kristofer
0 permalink
5/4/2010 1:34:29 PM

mkamoski
mkamoski
Posts: 46
Kris --

Wow, that is a real kick in the pants!!!

I did not know that and I do find it VERY interesting.

I really appreciate your KB.

Thank you.

-- Mark Kamoski
0 permalink
5/4/2010 2:01:29 PM

mkamoski
mkamoski
Posts: 46
All --

FWIW, here is an interesting link...

http://www.aspnettricks.com/archives/refresh-database-views/

...that may help one to refresh database Views.

HTH.

Thank you.

-- Mark Kamoski
0 permalink

Home » Huagati DBML/EDMX Tools Support » nullability update on views may not be working?





Powered by Jitbit Forum 7.1.0.0 © 2006-2011 Jitbit Software