SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


What will be the output of the following?


What will be the output of the following?

Author
Message
bazzkar
bazzkar
SSC-Enthusiastic
SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)

Group: General Forum Members
Points: 182 Visits: 72
Comments posted to this topic are about the item What will be the output of the following?
Paarthasarathy
Paarthasarathy
SSC-Enthusiastic
SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)SSC-Enthusiastic (187 reputation)

Group: General Forum Members
Points: 187 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
Piotr ER
Piotr ER
SSCertifiable
SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)

Group: General Forum Members
Points: 5276 Visits: 258
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.
sheik
sheik
SSC-Enthusiastic
SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)

Group: General Forum Members
Points: 146 Visits: 101
The table should be created with the identity (-1,-1). Then only we can get this result. Must be a typo error???.
john-byrne
john-byrne
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1499 Visits: 43
Since the question is wrong then everyone who selected "-1,0,1" should get a point!
:-):-D
bhandari220
bhandari220
Old Hand
Old Hand (398 reputation)Old Hand (398 reputation)Old Hand (398 reputation)Old Hand (398 reputation)Old Hand (398 reputation)Old Hand (398 reputation)Old Hand (398 reputation)Old Hand (398 reputation)

Group: General Forum Members
Points: 398 Visits: 23
Yes, To get -1,-2,-3 identity should be -1 insteed of 1.

Regards,
Pankaj Bhandari
Microsoft Certified Technology Specialist
ziangij
ziangij
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3270 Visits: 377
Yeah!... i have executed the query in SSMS 2005... and I get the result as "-1,0,1"

we should get our points back... :-D

john-byrne (6/27/2010)
Since the question is wrong then everyone who selected "-1,0,1" should get a point!
:-):-D

Nakul Vachhrajani
Nakul Vachhrajani
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2576 Visits: 2147
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 Smile

Thanks & Regards,
Nakul Vachhrajani.
http://nakulvachhrajani.com
Be courteous. Drive responsibly.

Follow me on
Twitter: @sqltwins
Google Plus: +Nakul
sumedha_2001jhanji
sumedha_2001jhanji
SSC Journeyman
SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)

Group: General Forum Members
Points: 78 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..... ;-)
chetanr.jain
chetanr.jain
Say Hey Kid
Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)

Group: General Forum Members
Points: 664 Visits: 563
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search