Jeremiah Clark's Blog - SQL: If Exists Update Else Insert "This is a pretty common situation that comes up when performing database operations. A stored procedure is called and the data needs to be updated if it already exists and inserted if it does not. If we refer to the Books Online documentation
Similar Posts
A few months ago, I wrote a post describing how SQL Server maintains unique indexes while avoiding false uniqueness violations. In this post, I'm going
In previous versions of T-SQL you had to use a trigger to retrieve data from inserted, updated or deleted rows in tables which wasn't very straightforward
To set up this scenario, run the script below CREATE DATABASE db2USE db2GOIF OBJECT_ID ('test1') IS NOT NULL DROP TABLE test1GOCREATE TABLE test1 (c1 tinyint
Consider the following schema CREATE TABLE T (PK INT PRIMARY KEY, A INT, B INT)CREATE INDEX TA ON T(A)CREATE UNIQUE INDEX TB ON T(B) INSERT T VALUES (0