SQL Server 2005 query shortcuts
SQL Server 2005 introduced some nice shortcuts for working with queries and identity or GUID key columns. These functions are specially useful if you want to write generic functions without worrying about the key names.
Given a table Article with an identity column the following query will retrieve all data and an extra column __pkey__ containing the primary key, whatever the name is.
Select $identity as __pkey__,*FromArticle
Replace $identity with $rowguid if you are using GUID primary keys.