I've two DataBases DB1 and DB2 in the same SQL Server instance. Here's the structure of both DBs
DB1
TableA:
[key] Id int
[required] Name nvarchar(50)
DB2
TableB:
[key] Id int
[required] Total real
[required] IdTableA int // Foreign key
In DB1 I also have a view:
TableBView:
select * from DB2.dbo.TableB
Now I run the following query
select Total
from DB1.TableBView
where Total > 100
I wanna know whether the SQL Engine:
- a) is running first the query defined by the view (which return all rows and all columns) b) and then select the rows where Total > 100 or
- it's applying the where statement directly to the View's query and it's only returning the column Total from the View's query?