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 Sunday, June 27, 2010 11:43 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, January 15, 2014 11:29 PM
Points: 50, Visits: 24
itseems like the answer or question posted is wrong!!
Post #943652
Posted Sunday, June 27, 2010 11:45 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Wednesday, March 12, 2014 3:59 AM
Points: 1,938, Visits: 1,149
Create Table MyTable( mainkey int not null identity (-1,1))
GO
insert into MyTable default values insert into MyTable default values insert into MyTable default values

Select * from MyTable

this will give result as this

-1
0
1

I think this type of question three weeks ago.this question is similar to the question on may 31 st 2010.


Malleswarareddy
I.T.Analyst
MCITP(70-451)
Post #943654
Posted Sunday, June 27, 2010 11:47 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Wednesday, March 12, 2014 3:59 AM
Points: 1,938, Visits: 1,149
sheik (6/27/2010)
The table should be created with the identity (-1,-1). Then only we can get this result. Must be a typo error???.


It's correct.


Malleswarareddy
I.T.Analyst
MCITP(70-451)
Post #943656
Posted Monday, June 28, 2010 12:06 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, February 20, 2014 11:27 PM
Points: 242, Visits: 92
i think there is something wrong with this answer coz it should be
-1,0,1 but ans is -1,-2,-3.
Post #943660
Posted Monday, June 28, 2010 12:11 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, February 20, 2014 7:17 AM
Points: 1,202, Visits: 45
I'm getting -1, 0, 1 as I would expect to be the right answer ( as almost all contributors)
Post #943664
Posted Monday, June 28, 2010 12:14 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 10:46 AM
Points: 3,241, Visits: 4,987
malleswarareddy_m (6/27/2010)
sheik (6/27/2010)
The table should be created with the identity (-1,-1). Then only we can get this result. Must be a typo error???.


It's correct.



Right.

Create Table MyTable1( mainkey int not null identity (-1,-1))
GO
insert into MyTable1 default values
insert into MyTable1 default values
insert into MyTable1 default values

Select * from MyTable1

drop table MyTable1


Now this code gives -1,-2,-3

Typing error. Lost my point...


----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Sometimes, winning is not an issue but trying.

You can check my BLOG here

Post #943665
Posted Monday, June 28, 2010 12:14 AM
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Tuesday, July 06, 2010 12:31 AM
Points: 663, Visits: 36
I think the question is wrong.
incase identity(-1,-1) then the answer ll be correct other wise will get -1,0,1 only.
Post #943666
Posted Monday, June 28, 2010 12:18 AM


SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Thursday, March 08, 2012 1:46 AM
Points: 148, Visits: 31
ditto

John
Post #943667
Posted Monday, June 28, 2010 12:22 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Wednesday, November 20, 2013 4:08 AM
Points: 1,849, Visits: 775
Must be typing mistake from the author of this question... but how can we have "-0" in the result.

Regards,
Rals
.
Post #943668
Posted Monday, June 28, 2010 12:23 AM
SSC-Addicted

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

Group: General Forum Members
Last Login: Wednesday, April 02, 2014 2:57 AM
Points: 413, Visits: 235
I think this is a typo.I want my point.
Post #943670
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse