Monday, November 21, 2005 10:21:18 PM UTC :: Filed Under ASP.NET | SQL | VB.NET

When writing SQL statements, it's a good practice to always use "AS" after calling each field. This will allow for column name changes that won't break your code.  For example, the following is a simple SELECT statement:

SELECT Id AS UserId, FirstName AS FirstName, LastName AS LastName FROM Users

If some of the column names change, such as the FirstName and LastName columns, my code won't break:

SELECT Id AS UserId, FirstName AS NameFirst, NameLast AS LastName FROM Users

Thanks to Jelle Druyts for this useful tip.

Navigation
On this page....
Search
Archives
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Categories
Contact me
Send mail to the author(s) Contact Todd M. Taylor