Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

What will be the output of the following? Expand / Collapse
Author
Message
Posted Saturday, June 26, 2010 11:14 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, September 3, 2010 4:19 AM
Points: 158, Visits: 72
Comments posted to this topic are about the item What will be the output of the following?
Post #943474
Posted Saturday, June 26, 2010 11:16 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, August 9, 2010 9:02 AM
Points: 153, Visits: 90
how come.. i am getting -1,0,1 only..
someone explain please


Kindest Regards,
Paarthasarathy
Microsoft Certified Technology Specialist
http://paarthasarathyk.blogspot.com
Post #943476
Posted Sunday, June 27, 2010 4:21 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Wednesday, April 27, 2011 9:10 AM
Points: 1,814, Visits: 60
first - all available answers are wrong. "-1,-0,1" is the better looking although you will not get "-0"
second - with identity (-1,1) you can only get -1, 0, 1. If you want to get -1,-2,-3 you would need identity(-1,-1)
There is something wrong with either question or with the answers.
Post #943536
Posted Sunday, June 27, 2010 8:16 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 10:25 PM
Points: 93, Visits: 94
The table should be created with the identity (-1,-1). Then only we can get this result. Must be a typo error???.
Post #943546
Posted Sunday, June 27, 2010 9:51 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Sunday, June 22, 2014 5:12 PM
Points: 890, Visits: 19
Since the question is wrong then everyone who selected "-1,0,1" should get a point!
Post #943628
Posted Sunday, June 27, 2010 10:10 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, March 22, 2011 4:53 AM
Points: 396, Visits: 23
Yes, To get -1,-2,-3 identity should be -1 insteed of 1.

Regards,
Pankaj Bhandari
Microsoft Certified Technology Specialist
Post #943632
Posted Sunday, June 27, 2010 10:33 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, June 30, 2014 2:51 AM
Points: 2,010, Visits: 369
Yeah!... i have executed the query in SSMS 2005... and I get the result as "-1,0,1"

we should get our points back...

john-byrne (6/27/2010)
Since the question is wrong then everyone who selected "-1,0,1" should get a point!
Post #943637
Posted Sunday, June 27, 2010 10:39 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 2:55 AM
Points: 1,414, Visits: 1,824
With an identity of (-1,1), -1, -2 and -3 is just not the possible output.

The first record that goes in will have -1. Next would be -1 + 1 = 0. Finally, we would have 0 + 1 = 1.

It's probably just a typo, and I am sure the moderators will take a look and award the points.

The points not being awarded is a typical drawback with the automated evaluation systems - after all, all automation works on GIGO. If there was an error in framing the question, there's bound to be an error in the evaluation. Just another example of why automation should not be allowed work without supervision :)


Thanks & Regards,
Nakul Vachhrajani.
http://beyondrelational.com/modules/2/blogs/77/nakuls-blog.aspx
Be courteous. Drive responsibly.

Follow me on
Twitter: @sqltwins
Google Plus: +Nakul
Post #943638
Posted Sunday, June 27, 2010 11:14 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, June 29, 2010 12:09 AM
Points: 76, Visits: 9
The answer is -1,0,1. The provided answer is wrong. To get -1,-2,-3, we have to set the identity increment as -1.

Juts give the points... 10 times of the actual point.....
Post #943643
Posted Sunday, June 27, 2010 11:30 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 3:00 AM
Points: 491, Visits: 552
Even i am getting the answer as "-1, 0, 1".
I have executed the query in SQL 2008 Enterprise edition.

i am agreeing with others about the fact that
to get ans as -1, -2, -3, the seed value should be -1.

@Moderator :
Look in this.
Post #943645
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse