Category Archives: SQL Tips and Techniques

Multiple divergences for S&P analyzed (Corrected)

Note: My first version of this had an error in the query which has been corrected and the difference between up and down days is not significant. However, the larger the VIX change, the more likely to be a VIX … Continue reading

Posted in SQL Tips and Techniques, Stock Market | Tagged , , | Leave a comment

Solving Sudoku with T-SQL

Note: This is an update to the earlier post to include the query to actually display the solved puzzle (for the skeptics… ) Recently I had to make a short trip and took a look at a Sudoku puzzle in … Continue reading

Posted in Problem Solving, SQL Server, SQL Tips and Techniques | Tagged , | 1 Comment

Normalizing time-series data using a table function in SQL

Recently I had to normalize quarterly, monthly, and ad-hoc reported metrics into daily rows in order to do correlative analysis. Below is the function that I came up with. The idea is to generate values that are in line with … Continue reading

Posted in SQL Server, SQL Tips and Techniques | Tagged | Leave a comment

Moving Databases from One Instance to Another Painlessly (Attach Statement Generator)

If you’ve ever had a bunch of databases and need to just move them to another instance without having to manually do the attach, these two scripts may be helpful. I recently was faced with this situation and have learned … Continue reading

Posted in SQL Server, SQL Tips and Techniques | Tagged | 2 Comments