Get the First Day of the Current Month

To get the first date of the current month, you could a query similar to the following: SELECT CONVERT(VARCHAR(25),DATEADD(DAY,-(DAY(GETDATE())) +1, GETDATE()), 105) Day1;

Get All the Tables with a Count of Their Records

Get all the tables with a count of their records with the following query: CREATE TABLE #Temp ( TableName VARCHAR(MAX), Rows INT ); EXEC sp_MSForEachTable @command1 = ‘INSERT INTO #Temp(TableName,

SQL Statistic Tests to Look Into

If you want to do statistics in SQL, the following tests will be very useful to look into: Pearson’s Correlation Kendall’s Tau Rank Correlation Simple Linear Regressions The Kruskal-Wallis Test

Working with Multiple Query Windows

Working with and comparing multiple queries at the same time can be a pain, at least for me. Two independent query windows take up more space on screen, or having

Selecting All Columns, Separated with Commas

Sometimes you want to select all the columns, without using the *. Specifying column names speeds up your query. The problem comes in with large tables or tables with difficult

Object Explorer Details

I hate repetitive tasks. I am not a robot. However, the problem is that there are some tasks that can be quite repetitive or just take too many steps to

Using Multi Edit Mode

This is a neat trick I have learnt recently. When dealing with large lists of information, we, as developers, sometimes need to copy them, then add commas manually. Say, for