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: 2 days ago @ 11:39 PM
Points: 1,015, Visits: 1,289
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


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Sunday, July 20, 2014 4:15 AM
Points: 1,402, Visits: 1,803
Great question. Thank-you.

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

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


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Sunday, July 20, 2014 11:20 PM
Points: 13,252, Visits: 10,133
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
SSC Eights!

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

Group: General Forum Members
Last Login: 2 days ago @ 1:33 AM
Points: 904, Visits: 837
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


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Sunday, July 20, 2014 4:15 AM
Points: 1,402, Visits: 1,803
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://beyondrelational.com/modules/2/blogs/77/nakuls-blog.aspx
Be courteous. Drive responsibly.

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


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Sunday, July 20, 2014 11:20 PM
Points: 13,252, Visits: 10,133
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: Monday, July 21, 2014 6:24 AM
Points: 2,451, Visits: 2,342
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: 2 days ago @ 11:39 PM
Points: 1,015, Visits: 1,289
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