Suppose one have to update table data and after that query the same table. It seems like a common task and it is possible to perform this using a single T-SQL statement. Definitely cool trick from Todd Carrico. So, this is how to perform update and popuate parameters in the same query: