[dba-SQLServer] Does view support column alias?

Susan Harkins ssharkins at gmail.com
Mon Feb 23 12:07:28 CST 2009


I thought views supported column alias for a derived column, but I'm getting 
an error when I refer to the aliased column in a WHERE clause -- am I 
mistaken about this?

CREATE VIEW
FROM transactions
SELECT id, quantity * cost AS [Total Cost]
WHERE [Total Cost] > 100

Plain SQL returns an error -- I know that -- but I expected the View to 
handle the column alias in the WHERE clause. Not finding anything helpful so 
far. I can't even say why I thought the View would handle this other than I 
guess I've read it somewhere and it stuck. I can't find any views where I've 
actually applied this.

Susan H.




More information about the dba-SQLServer mailing list