I have a view that selects data from a table that is showing different data.
The table is dbo.user
, the view is dbo.users
(don't judge, I inherited this system). The view is simply select * from table
.
If I run the following statements:
SELECT Field1, Field2 FROM dbo.[User] WITH (NOLOCK) ORDER BY Field1;
SELECT Field1, Field2 FROM dbo.Users WITH (NOLOCK) ORDER BY Field1;
I get different values for one of the fields. See the attached pic:
Any ideas how this happens? The table is clustered, has a pk and unique index.
*
and let us know if that fixes the problem. Then neverSELECT *
again haha – Avarkx Apr 15 '15 at 20:13WITH SCHEMABINDING
? Asp_refreshview viewName
will help as well. – Kin Shah Apr 15 '15 at 20:27SELECT *
. See sqlblog.com/blogs/aaron_bertrand/archive/2009/10/10/… – Aaron Bertrand Apr 15 '15 at 21:01