constraints

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

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

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

Publish ADF from code to further environments

By

Struggling with #ADF deployment? adf_publish branch doesn’t suit your purposes? Don’t have skills with PowerShell? I have good...

Getting the Proc Code–#SQLNewBlogger

By

Another post for me that is simple and hopefully serves as an example for...

Running SQL Server in Google Cloud Platform

By

On a few occasions I’ve referred to GCP (Google Cloud Platform) as the “Windows...

Read the latest Blogs

Forums

How to efficiently perform search on my DB and Word documents on my server?

By umeshamin

So I'm building a system for a client and they want to have a...

Copy Azure SQL DB App data to Azure Synapse

By DataBanker

Hello, I am looking for the best way to copy change data from my...

Enable normal user to execute a sys stored procedure

By SZ

I tried GRANT EXECUTE ON OBJECT :: sys.sp.droprolemember TO John; GO Cannot find the...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers