What does the following variable assignment mean in T-SQL?
SET @myvariable += 'test'
What does the following variable assignment mean in T-SQL?
SET @myvariable += 'test'
+= (Addition Assignment) : Adds two numbers and sets a value to the result of the operation. For example, if a variable @x equals 35, then @x += 2 takes the original value of @x, add 2 and sets @x to that new value (37)
+= (String Concatenation Assignment) : Concatenates two strings and sets the string to the result of the operation. For example, if a variable @x equals 'Adventure', then @x += 'Works' takes the original value of @x, adds 'Works' to the string, and sets @x to that new value 'AdventureWorks'.
set @value1 = 'Hello'
set @value1 = ' World'
print @value1
Output: World
set @value2 = 'Hello'
set @value2 += ' World'
print @value2
Output: Hello World