I have been told that views in MS SQL aren’t very good to use. Let’s say that you have a view X with 2 columns Car and Color that looks like this
Car Color
----- ------
Alfa Yellow
Volvo Yellow
Volvo Blue
Ford Yellow
Ford Blue
If you then run the following statement to get all Fords that are yellow:
select * from X where Car=’Ford’ and Color=’Yellow’
I have been told that when you run this statement the database will return all rows where the Car is Ford and all rows where the Color is Yellow and then the client filter out the Fords that are yellow, that is:
This is returned to the client side:
Alfa Yellow
Volvo Yellow
Ford Yellow
Ford Blue
Then the filtering is done on the client side so I only get the Ford that is yellow. I was told that I shouldn’t use the views cause of this.
I think this sounds very strange and can’t believe that views work in this way. I thought all processing was done in the database and then only returns what I want, the yellow Ford.
Could anyone clarify this for me? Give me some links where I can read about this?
Thanks in advance
Markus