•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 423,880 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,185 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 11344 | Replies: 2
![]() |
•
•
Join Date: Jun 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
Views are basically a few tables group together by a server side query.
would return only Ford = Yellow
would return
You can create a view by creating a sql query on the server, since it runs on the server, it is usually fasterthan the client requesting x number of tables and y pieces from each one.
I believe the information you recieved may be a little inaccurate
•
•
•
•
select * from X where Car=’Ford’ and Color=’Yellow’
would return only Ford = Yellow
select * from X where Car=’Ford’ or Color=’Yellow’
would return
Alfa Yellow Volvo Yellow Ford Yellow Ford Blue
You can create a view by creating a sql query on the server, since it runs on the server, it is usually fasterthan the client requesting x number of tables and y pieces from each one.
I believe the information you recieved may be a little inaccurate
![]() |
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- help with paging in sql 2000 (MS SQL)
- retrieving a particular value with a sql query (PHP)
- Urgent Help with SQL Query (MySQL)
- Does Flash Work With SQL (Graphics and Multimedia)
- VB and MS-sql 2000 data navigation (Visual Basic 4 / 5 / 6)
- oracle or sql server2000, which is best? (Oracle)
Other Threads in the MS SQL Forum
- Previous Thread: grouping unique name in table
- Next Thread: Is it compulsory to have atleast one Unique per table in Sql Server2000?


Linear Mode