Sunday, February 28, 2010

@@IDENTITY

What will be the value of @@IDENTITY in the last row?
DECLARE @Test TABLE(a INT IDENTITY(1,1), b TINYINT)
INSERT INTO @Test(b) VALUES(1)
INSERT INTO @Test(b) VALUES(256) --Error is generated here, arithmetic overflow
INSERT INTO @Test(b) VALUES(255)
SELECT @@IDENTITY

A. NULL
B. 2
C. 3
D. 1

Answer:[C]
Highlight to find out the answer.

No comments:

Post a Comment