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 1234»»»

Incremental additions Expand / Collapse
Author
Message
Posted Thursday, October 28, 2010 8:28 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, September 16, 2010 7:13 AM
Points: 315, Visits: 93
Comments posted to this topic are about the item Incremental additions

Praveen Goud
Post #1012784
Posted Thursday, October 28, 2010 10:10 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 5:13 AM
Points: 1,131, Visits: 1,394
Nice question. Thanks

Thanks
Post #1012805
Posted Thursday, October 28, 2010 11:14 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, January 30, 2012 4:12 AM
Points: 384, Visits: 98
Good question.
Thanks
Post #1012813
Posted Thursday, October 28, 2010 11:22 PM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Yesterday @ 10:22 PM
Points: 1,457, Visits: 1,858
Great question. Thank-you.

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

Follow me on
Twitter: @sqltwins
Google Plus: +Nakul
Post #1012816
Posted Friday, October 29, 2010 12:13 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 5:04 AM
Points: 13,641, Visits: 11,514
Good question, but I've liked a little more explanation and if possible, a reference.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1012825
Posted Friday, October 29, 2010 12:36 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, December 19, 2014 6:02 AM
Points: 1,012, Visits: 1,008
Great question, thanks

Here is a reference to the compound operators: http://msdn.microsoft.com/en-us/library/cc645922.aspx

Regards,
Iulian
Post #1012833
Posted Friday, October 29, 2010 12:53 AM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Yesterday @ 10:22 PM
Points: 1,457, Visits: 1,858
I guess the subtle point is that SQL Server will NOT throw any syntax errors because ultimately what the user is making is a logical error.
It's one of those things that one would miss when writing code in a hurry, and then spend endless nights trying to figure out what went wrong.


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

Follow me on
Twitter: @sqltwins
Google Plus: +Nakul
Post #1012839
Posted Friday, October 29, 2010 12:54 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 5:04 AM
Points: 13,641, Visits: 11,514
Iulian -207023 (10/29/2010)
Great question, thanks

Here is a reference to the compound operators: http://msdn.microsoft.com/en-us/library/cc645922.aspx

Regards,
Iulian


Thanks for the reference, but it still doesn't explain the question. In the question =+ is used, while the compound operator used in SQL Server is +=. I've done a little research, and it seems that a++ is the post-increment operator and ++a the pre-increment operator.

(see http://bytes.com/topic/c/answers/506780-difference-between-pre-increment-post-increment).

So it seems that the explanation of the question is wrong, as it states that the pre-increment operator is not used in SQL Server. SQL Server uses however a compound operator, meaning addition and assign, not incrementing the value. It still remains unknown to me why SQL Server ignores the + in =+ instead of giving a syntax error.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1012840
Posted Friday, October 29, 2010 1:13 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 3:48 AM
Points: 2,622, Visits: 2,468
So it seems that the explanation of the question is wrong, as it states that the pre-increment operator is not used in SQL Server. SQL Server uses however a compound operator, meaning addition and assign, not incrementing the value. It still remains unknown to me why SQL Server ignores the + in =+ instead of giving a syntax error.

Yes, explanation is wrong!
@a=+@b means simply that you assign an +(expression) to @a.
+ is unary operator: http://msdn.microsoft.com/en-us/library/aa276846(SQL.80).aspx

Post #1012842
Posted Friday, October 29, 2010 1:20 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 5:13 AM
Points: 1,131, Visits: 1,394
Carlo Romagnano (10/29/2010)
So it seems that the explanation of the question is wrong, as it states that the pre-increment operator is not used in SQL Server. SQL Server uses however a compound operator, meaning addition and assign, not incrementing the value. It still remains unknown to me why SQL Server ignores the + in =+ instead of giving a syntax error.

Yes, explanation is wrong!
@a=+@b means simply that you assign an +(expression) to @a.
+ is unary operator: http://msdn.microsoft.com/en-us/library/aa276846(SQL.80).aspx


Thanks for the link. Hence, @a =+ @b means @b value assign to @a so @a = -21.


Thanks
Post #1012844
« Prev Topic | Next Topic »

Add to briefcase 1234»»»

Permissions Expand / Collapse