Solving tech problems

How to import Odoo database and browse locally

Databases

If you use Odoo CRM solution, you can login into your account and under it you will find My Databases. When you click on it, you will be able to export existing database (to make a dump of it). This will be used for import on your local machine. Download this dump archive to your PC. Now, you need to install PostgreSql Database Server on your machine. I am using Windows and I choose to install version 14. You need to have 64-bit Windows OS and you can download PostgreSql…read more

MySQL importing from dump file error 1118 – Row size too large

Databases

Hi, If you have faced a problem when importing your data to MySQL from a large file and it said: ERROR 1118 (42000) at line xxx: Row size too large (> 8126) This is a known bug for MySQL versions 5.6.20.0, 5.6.21.0 and I noticed that I didn’t have this problem at version 5.6.24. In order to make it work also on MySQL 5.6.21.0 edit your “my.ini” configuration file and increase the innodb log size like this: innodb_log_file_size = 256M Hope it solves you the problem, like it helped me,…read more

How to delete duplicated records in MS SQL Server?

Databases, Programming

First, create one demo table Let’s create one demo table first. It will be called Person and will hold some fictive person data. Now, fill the data Insert some fictive person data and do some duplicated records that have the same values for fieldsĀ  firstname, lastname and email. Now the magic Use this subquery trick to extract duplicate records and then delete them. Notice the use of PARTITTION and WITH Transact-SQL keywords. All records that have RowNumber > 1 are deleted.

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:

Using SQL Server PIVOT feature to transform rows into columns

Databases, Programming

PIVOT queries in SQL Server are useful when we need to transform data from row-level to column-level. Example: Imagine having the table named Invoice (payments per month) – for simplicity let’s say that we have PaidDate and Amount. What we wanted now is to get total money collected from the beginning of the year 2014, and in order to do this we can use this PIVOT query: And we finally get

MS SQL Server 2014 “Hybrid” to attack MongoDB

Databases

On April 1st 2014 MS SQL Server 2014 is internally released for small group of big customers such as bwin and others. The biggest improvement is in-memory OLTP engine to deliver breakthrough performance to their mission critical applications. Company bwin scale its applications to 250K requests a second, a 16x increase from before, and provide an overall faster and smoother customer playing experience. The new In-Memory OLTP engine (formerly code named Hekaton), provides significantly improved OLTP performance by moving selected tables and stored procedures into memory. Hekaton enables you to use both…read more

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