Paging in SQL Server 2005 with ROW_NUMBER: CTE vs. derived table. I compare both methods and show they give the same performance for common queries.
SQL SERVER – Retrieve – Select Only Date Part From DateTime – Best Practice
The best way to select only the date part from a DATETIME value: my team member’s DATEADD and DATEDIFF method, and the CONVERT style 111 method I prefer.
SQL SERVER – UDF – Function to Display Current Week Date and Day – Weekly Calendar
A script and UDF that show each current week date with its day, from Sunday to Saturday, using DATEPART and DATEADD. Handy for a weekly calendar report.
SQL SERVER – User Defined Functions (UDF) Limitations
Why are stored procedures more flexible? Here are the User Defined Functions (UDF) limitations: fewer input parameters, no GETDATE(), one result set, and more.
SQL SERVER – 2005 Limiting Result Sets by Using TABLESAMPLE – Examples
TABLESAMPLE returns a random sample of rows by percent or row count. My examples show why the same query returns a different number of rows each time.
SQL SERVER – Script/Function to Find Last Day of Month
A one line DATEADD query to find the last day of month for any date. It handles leap years: February 2008 gives the 29th and 2007 the 28th.
SQL SERVER – Math Functions Available in SQL Server
One list of the Math Functions available in SQL Server, from ABS and CEILING to SQRT and TAN, and why RAND is the only nondeterministic one among them.






