Programming Stuff

The Blog

PIVOT in SQL Server – Correct Aggregated Results

This is my first time using PIVOT and something I learned was: projection ( SELECT) is essential for correct aggregated results. Here a sample using a Sales table (link to download script file at the bottom): Here a wrong way to do a PIVOT , here […]

Entity Framework: Pagination Behind the Scenes

Data pagination is always a headache. We should customize every time we want to gain performance in a large data result. In this post, I will show you the correct way to do pagination by snicking the code generated by Entity […]

DB Queries for Pagination

Query Version:

Source: (Query)

Fix SQL Collation Error

I tried to create a Trigger that update the table in another Database and I got this error

I search for a solution and I found many partially solution, like especify the collacation on the select… so what about […]

Random Number in SQL

I just wanted to update some records using random number in SQL Server and I found that it was not easy… Exists the function RAND() but Doesn’t work in the way that I expected. For instance, I was trying to […]