constraints

External Article

Declarative SQL: Using UNIQUE Constraints

  • Article

In SQL, you can express the logic of what you want to accomplish without spelling out the details of how the database should do it. Nowhere is this more powerful than in constraints. In this introduction to Declarative SQL, Joe Celko demonstrates how you can write portable code that performs well and executes some complex logic, merely by creating unique constraints.

2015-12-15

6,149 reads

External Article

Set-based Constraint Violation Reporting in SQL Server

  • Article

When you're importing data into an RDBMS in bulk and an exception condition is raised because of a constraint violation, you generally need to fix the problem with the data and try again. The error won't tell you which rows are causing the violation. What if you've thousands of rows to search when it happens? There are solutions, writes William Sisson.

2014-10-16

8,821 reads

External Article

SQL Server Unique Constraints for Large Text Columns

  • Article

We are storing large text and URLs that are over 900 bytes in some of our tables and have a requirement to enforce uniqueness in those columns. But SQL Server has a limitation that index size can't be over 900 bytes. How do I enforce uniqueness in these columns and is it possible to achieve this in SQL Server 2005 and above? What are my different options to solve this problem? I heard that we can use CHECKSUM to create a hash, but is it possible to avoid collisions in the hash value as we are storing millions of rows?

2009-11-05

3,006 reads

Blogs

Redgate Summit Comes to the Windy City

By

I love Chicago. I went to visit three times in 2023: a Redgate event,...

Non-Functional Requirements

By

I have found that non-functional requirements (NFRs) can be hard to define for a...

Techorama 2024 – Slides

By

You can find the slidedeck for my Techorama session “Microsoft Fabric for Dummies” on...

Read the latest Blogs

Forums

Clear Trace - Asking for SQL Server 2008

By rameshbabu.chejarla

Hi, I have SQL Server 2019 installed and when go the Clear Trace database...

get all txt files $filenameAndPath = code please help

By juliava

Hello I need to get txt files from directory and send email, when I...

Always on Availability groups cluster question

By GreatPancake

Hello, I have a question regarding Availability group server architecture. A little background: We...

Visit the forum

Question of the Day

The "ORDER BY" clause behavior

Let’s consider the following script that can be executed without any error on both SQL Sever and PostgreSQL. We define the table t1 in which we insert three records:

create table t1 (id int primary key, city varchar(50));

insert into t1 values (1, 'Rome'), (2, 'New York'), (3, NULL);
If we execute the following query, how will the records be sorted in both environments?
select city

from t1

order by city;

See possible answers