String of Digits
A popular task is to check if a string contains only digits. For example, you need to check if the user entered the correct phone number, index or a tax code of an organization. There are several ways to solve this task, which differ in their efficiency. Let's take a look at the most popular ones.
Строка из чисел
Популярная задача — определить, состоит ли строка только из числовых символов. Например, нужно проверить, что пользователь правильно ввел номер телефона, индекс или ИНН организации. Сделать это можно несколькими способами, которые отличаются своей эффективностью. Давайте рассмотрим самые популярные из них.
Any() vs Count: part 2
In Part 1, we compared Any()
and Count
methods for different collections and proposed optimization approaches.
Any() vs Count: часть 2
В первой части мы сравнивали методы Any()
и Count
для различных коллекций и предложили вариант оптимизаций.
Прошло достаточно времени, чтобы провести повторное сравнение.
nvarchar(max) vs nvarchar(N)
MS SQL Server offers several data types for storing strings.
The most popular are nvarchar(N)
(1 ≤ N ≤ 4000) and nvarchar(max)
, which allow storing Unicode-encoded string data.
Application developers often transfer their experience with the string
type from programming languages like C# or Java to databases and automatically choose nvarchar(max)
, which can store strings up to 2GB.
However, databases store and process data in fundamentally different ways.
In this article, I will explain and demonstrate the consequences of unjustified use of the nvarchar(max)
type.