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

Question of the Day for 22 Dec 2006 Expand / Collapse
Author
Message
Posted Wednesday, December 13, 2006 6:05 PM
SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, May 18, 2007 3:36 PM
Points: 10,039, Visits: 1
Comments posted to this topic are about the Question of the Day for 22 Dec 2006 posted at http://www.sqlservercentral.com/testcenter/qod.asp?QuestionID=927.
Post #330359
Posted Friday, December 22, 2006 7:34 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Wednesday, October 8, 2014 4:15 AM
Points: 20,581, Visits: 9,619
So may I ask what is the point of using that operator at all?
Post #332499
Posted Friday, December 22, 2006 9:06 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 12:34 PM
Points: 31,204, Visits: 15,649
Fill a QOD slot?

Not sure myself, but probably better programmers that I have some use for it. Or maybe it's just the math PhD in Redmond wanted to get the entry in BOL?

Maybe I'll ask what the Unary operator is next year and it will be worth 12 pts.

I thought ninjas liked those obscure facts?!?!







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #332535
Posted Friday, December 22, 2006 9:10 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Wednesday, October 8, 2014 4:15 AM
Points: 20,581, Visits: 9,619

I do, that's why I ask the question.  I read the books online section for unary operator and that doesn't clear it up much.

 

I'm sure there must be a valid use for it but I just don't see it.

Post #332537
Posted Friday, December 22, 2006 1:33 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 6:53 PM
Points: 967, Visits: 388

It's there to confuse.  I once had a problem where the programmer used =+ where he meant += in some c# code. 

That was a hard one to find, because it was syntactically correct. 

Hey, do ninjas do Christmas?  If so, have a merry one!

And the same to you, Steve.

jg

 

 

Post #332626
Posted Friday, December 22, 2006 2:44 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Wednesday, October 8, 2014 4:15 AM
Points: 20,581, Visits: 9,619
Thanx for the info.  merry xmas to you to!
Post #332644
Posted Thursday, December 13, 2007 8:25 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, August 2, 2013 3:14 PM
Points: 82, Visits: 88
Just as a note, you don't have to use ABS to get the positive value for a negative, use
declare @i int
select @i = -5
select -@i
Post #432879
Posted Friday, December 28, 2007 3:28 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, September 26, 2014 12:42 AM
Points: 215, Visits: 99
It just doing simple mathmetical expression,
For ex -
declare @i int
select @i = -5
select @i*@i

Answer = 25

declare @i int
select @i = 5
select @i*-@i

Answer = -25

declare @i int
select @i = 5
select -@i*-@i

Answer = 25


Mohammad Irfan
http://matespoint.blogspot.com
http://www.irfit.com
Post #436971
Posted Thursday, November 22, 2012 11:56 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 2:47 AM
Points: 1,926, Visits: 2,352
nice question and nice explanation by Hardcoder


_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1388057
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse