SQL

Sql code posted by jim
created at 08 Jun 17:15

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
DECLARE @OriginalRecord TABLE (id INT NOT NULL, email NVARCHAR(150) NULL)
DECLARE @UpdatedRecord TABLE (id INT NOT NULL, email NVARCHAR(150) NULL)

INSERT INTO @OriginalRecord  VALUES ( 1, 'tester@lhh.com')
INSERT INTO @UpdatedRecord VALUES ( 1, 'tester@lhh.com')

SELECT *
FROM @UpdatedRecord
EXCEPT
SELECT *
FROM @OriginalRecord

UPDATE @UpdatedRecord SET email = NULL

SELECT *
FROM @UpdatedRecord
EXCEPT
SELECT *
FROM @OriginalRecord

UPDATE @UpdatedRecord SET email = 'BestDBAEver@hot.com'

SELECT *
FROM @UpdatedRecord
EXCEPT
SELECT *
FROM @OriginalRecord

UPDATE @UpdatedRecord SET email = 'bestdbaEver@hot.com'

SELECT *
FROM @UpdatedRecord
EXCEPT
SELECT *
FROM @OriginalRecord
719 Bytes in 5 ms with coderay