Multi-Row Variable Assignment and ORDER BYCommented on: 4 years ago
(February 4, 2010)
These lists are often for a child table, where the covering index is likely to be on the foreign key from the parent table, plus the key for the child entity. But it's good to know that these bloody-...
T-SQL Challenge – Efficient Partitioned TOPCommented on: 4 years ago
(October 2, 2009)
With a smaller number of rows, the CTE solution seems more efficient than this time-proven GROUP BY syntax. Putting the two queries in a batch, the CTE takes up around 36%.
select t1.grp, t1.col1,...
Catch That Bug! Random Row per GroupCommented on: 7 years ago
(October 20, 2006)
In order for the subquery to pick a random entry, you need to drop the ORDER BY clause, rather than using one.
Not sure why not all EmployeeId-s are returned, but this behaviour may already...
When DBAs and SysAdmins learn the ins-and-outs of AlwaysOn Availability Groups, they’re then able to address high availability and disaster recovery concerns from a single interface or set of tooling, thus providing better scalability of management....More