July 16, 2009 at 9:28 pm
Comments posted to this topic are about the item Identity_column
July 17, 2009 at 3:36 am
Actually, won't the comma after the lname column cause a syntax error? So, of those answers, "no rows will be inserted" is technically the most correct answer.
Jim
July 17, 2009 at 4:00 am
True, but that won't cause no rows to be inserted, it''l stop the table creation in the first place...
July 17, 2009 at 4:55 am
The syntax is forgiving about the extra comma. I tried it and was able to create the table per the script.
Seems this has come up in the course of my typing Create statements -- add the comma by default then decide no more columns are needed and the table still creates. Another example is when generating Create Table statements.
July 17, 2009 at 5:36 am
I'm sorry but you're wrong. This query as written will fail for syntax reasons. The comma after lname varchar(20), requires that another field be listed next, but one is not listed, therefore it will fail (which is answer A).
July 17, 2009 at 5:45 am
Although I got the question right (I did not notice the extra comma), I agree this is a bad question. When you get the error message, no records get inserted into the table. Both the first and last option was correct.
I knew either of them could have been the correct answer but the last one was more specific to the problem on why no records would have been inserted. Still, I believe anyone who selects the first answer should also get it right.
July 17, 2009 at 6:07 am
Which version is giving you an error message?
It executes fine in 2008. I tried because my recollection was that the comma does not cause a problem and hasn't for several versions.
create table employe
(
id_num int identity(1,1),
fname varchar(20),
lname varchar(20),
)
Command(s) completed successfully.
July 17, 2009 at 6:07 am
I stand corrected. I just tried this query, as written, on both SQLServer 2000 and 2005 and the table DOES get created, even in spite of the extra comma.
Jim
July 17, 2009 at 6:45 am
I'm with you guys, I assumed that the comma would cause it to error before the table even got created.
So, despite the ambiguous choices, learned something new!:-D
---------------------------------------------------------
How best to post your question[/url]
How to post performance problems[/url]
Tally Table:What it is and how it replaces a loop[/url]
"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
July 17, 2009 at 10:22 am
didn't notice the comma, but I realized the intent of the question.
July 17, 2009 at 11:48 am
Actually the answer is "NONE OF THE ABOVE". The answer (deemed correct) refers to IDENTITY INSERT set to ON. This query will run if IDENTITY INSERT is set to on. However, it is off. The actual error message refers to IDENTITY INSERT SET TO OFF. Minor verbiage change, but can make a big difference (several previous questions had details like this that made the difference between right and wrong so consistency should be maintained).
CORRECTION: I just now saw the "not". The error message actually says "hen IDENTITY_INSERT is set to OFF" The "not" through me off.
Cheers,
Brian
July 17, 2009 at 4:42 pm
sorry - posted about the comma without seeing all the other posts - dunno whats wrong with this browser of mine...
MM
select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);
July 17, 2009 at 9:15 pm
yup
August 25, 2009 at 12:03 pm
I too missed the extra comma but saw the intent of the question. Despite that, it is nice to have learned something about the extra comma in table creates.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
November 23, 2009 at 11:01 pm
It was straight forward Q, and had a straight forward ans. 🙂
Viewing 15 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply