Solving tech problems

Using SQL Server APPLY command in queries

Databases

APPLY clause in Transact-SQL is interesting because it can be user in the following scenario: For example, you might create a query that returns a list of payments (in this case last 2 payment amounts and dates) for each subscriber inside your SaaS product. You get something like this 958 Usain Jordan 2014-06-01 299.00 958 Usain Jordan 2014-07-18 458.00 110 Seagal KungFu 2014-01-12 15.16 110 Seagal KungFu 2014-03-06 17.45

How do you copy entire MongoDB database?

Databases

I faced small problem how to duplicate entire MongoDB database and I tried just to rename folder under data directory. So, instead of having my_database I just renamed it to my_new_database but it didn’t helped and when I used show collections it returned me an empty set. I also tried to rename files inside data/my_database to my_new_database but this didn’t helped me either. So, I finally looked into the documentation and found this command which copies the entire database:

How to get list of sequential dates in MS SQL Transact SQL and cursors alternative

Databases

Let’s imagine that we have table where we store some service prices and that this price can vary regarding period of the year. You would then have something like this in your table: $50 from January 1st to May 31th $70 from June 1st to October 31th $60 from November 1st to December 31th What we want is to get all daily prices for given date region. So, if we give range from May 15th to 15th June we want to get this: May 15th $50 May 16th $50 May…read more

MongoDB vs MS SQL Server Comparison

Databases

We are using both databases for our projects and we can finalize some thoughts on both of them… Mongo Facts Free – official website is here and you can download it here Because it is using NoSQL concept it is really extremely fast when it comes to the inserts into database. It is almost fast as writing directly into the disk. It is at least 10 times faster when doing inserts. Because is is using NoSQL there is no scheme, you just store your object into database (JSON serialization is…read more