Here is a quick SQL Server teaser
Create the following table
CREATE TABLE [barney ]
(
barneyId INT
)
Then look at the following 4 statements which one will fail?
Do not run the statements try to guess, Is it A, B, C or D (or more than one?)
--A
INSERT [barney ] VALUES (1)
--B
INSERT barney VALUES (1)
--C
INSERT "barney" VALUES (1)
--D
INSERT [barney] VALUES (1)
BTW the idea for this post came after reading "Another reason to hate quoted identifiers..." on Louis Davidson's blog
2 comments:
Im using SQL 2005 and none of them fail for me! 4 inserted rows.
Yep same here, I ran it on 2000 and 2005
I did expect the last two to fail somehow
Post a Comment