January 6, 2011 at 5:39 am
I have tested this.
In context of SQL Server 2000 it is correct answer as by you.
But In SQL Server 2008 answer will be 1,2,3,4.
😛
January 26, 2011 at 11:32 pm
I executed the scriptin SQL Server 2005, Got following output -
What you see...
-----------------------
print 1
-- Comment one
print 2
-- Comment two
print 3
-- Comment three
print 4
is not what you get!
-----------------------
1
2
3
4
I want to understand why the output will be 1, 3, 4?? Can anyone explain how it is correct?
January 27, 2011 at 4:57 am
tejaswini.patil (1/26/2011)
I want to understand why the output will be 1, 3, 4?? Can anyone explain how it is correct?
Have you tried reading the rest of the comments? It's already been pointed out multiple times that the answer as given only applies to SQL 2000--later versions produce 1,2,3,4.
April 29, 2011 at 12:55 pm
I suppose it would be SQL 2000 vs SQL 2005 and the bug has been fixed, but I want that point. :alien:
May 17, 2011 at 5:24 am
me too...
May 17, 2011 at 5:41 am
terrykzncs (4/29/2011)
I suppose it would be SQL 2000 vs SQL 2005 and the bug has been fixed, but I want that point. :alien:
Not quite. It is indeed SQL 2000 vs SQL 2005. But rather than a bug having been fixed, a really stupid bug has been added - intentionally. See http://www.sqlservercentral.com/Forums/FindPost1038756.aspx for a simple explanation.
Tom
December 21, 2014 at 12:49 pm
It would be useful to see in a question the exact version of the SQL Server used for the test.
Moreover , the "bug" has disappeared after the arrival of the SP3 which should have been applied already in 2010 when this question was proposed .
Is there any control about the correctness of the solution ?
If the question is related to SQL Server 2005 RTM , I am doubting that there are many DBA accepting not to have installed the last service pack ( at least for security reasons ).
Viewing 7 posts - 61 through 66 (of 66 total)
You must be logged in to reply to this topic. Login to reply