Technical Article

List All Constraints

These four scripts list concise information about all Default, Check, Unique, Foreign Key, and Primary Key constraints for the database in which they are run.  With minor column modifications, they could easily be unioned to provide a single list. The usual caveat applies about directly accessing system tables. They may change in future versions and/or […]

You rated this post out of 5. Change rating

2003-08-14

1,090 reads

Technical Article

Find Duplicate Employees, Customers, Etc.

Customers, employees, etc. come and go.  They get entered multiple times in inconsistent formats in databases.This simple script finds the duplicates across multiple formats and is easily modified as needed.  It's so easy, my grandmother could do it. Oops! No offense Grandma.For very large databases, create and join two temp tables indexed on the namedatetring […]

You rated this post out of 5. Change rating

2003-05-30

203 reads

Technical Article

Find Duplicate Indexes - Episode 1 (The Early SQL Versions)

The excellent script contributed by G.R. Preethiviraj Kulasingham (Preethi) Sri Lanka (contributed 2/20/03, modified 5/22/03) identifies duplicate indexes for the database on which the script is run.  It requires User Defined Functions, a feature restricted to SQL Server 2000.This version achieves similar results without using UDFs or creating any other permanent objects. It therefore works […]

4 (1)

You rated this post out of 5. Change rating

2003-05-28

758 reads

Blogs

T-SQL Tuesday #180: Avoid Perfect for Good Enough

By

I'm listening to Effortless by Greg McKeon (link to author's page) through Audible.com. He...

Book Review – Humanizing Data Strategy by Tiankai Feng

By

This book was making its rounds on social media, and the concept seems interesting...

Monday Monitor Tips: Tracking The Cost of Instances

By

One of the things that I’ve been asked in every operations situation is what...

Read the latest Blogs

Forums

Does SSRS Report with Stored Procedure execute SQL string?

By danyeungw

I declare @Where based on the input parameter in the stored procedure. Set @SQL...

SQL Server Constrained Delegation

By cw255

Hi, hoping someone can help. We're in the process of migrating to a new...

Get Sum and Last month sum

By GrassHopper

I want to get the sum and I want to get the sum of...

Visit the forum

Question of the Day

Comparing Images

I am building an ETL process between these tables in SQL Server 2022 set to 160 compatibility level:

CREATE TABLE Image_Staging
( imageid     INT NOT NULL CONSTRAINT Image_StagingPK PRIMARY KEY
, imagestatus TINYINT
, imagebinary IMAGE);
GO

CREATE TABLE Images
( imageid       INT NOT NULL CONSTRAINT ImagesPK PRIMARY KEY
, imagestatus   TINYINT
, imagemodified DATETIME
, imagebinary   IMAGE);
GO
I want to run this query to check if the images already loaded exist. This will help me decide if I need to insert or update an image. What happens with this query?
SELECT i.imageid
FROM
  dbo.Image_Staging AS ist
  INNER JOIN dbo.Images AS i
    ON ist.imagebinary = i.imagebinary;

See possible answers