Pastaba.
Prieigai prie šio puslapio reikalingas įgaliojimas. Galite bandyti prisijungti arba pakeisti katalogus.
Prieigai prie šio puslapio reikalingas įgaliojimas. Galite bandyti pakeisti katalogus.
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'.
Transact-SQL Syntax Conventions
Syntax
expression += expression
Arguments
- expression
Is any valid expression of any of the character data types.
Result Types
Returns the data type that is defined for the variable.
Remarks
SET @v1 += 'expression' is equivalent to SET @v1 = @v1 + 'expression'.
The += operator cannot be used without a variable. For example, the following code will cause an error:
SELECT 'Adventure' += 'Works'
Examples
The following example concatenates using the += operator.
DECLARE @v1 varchar(40);
SET @v1 = 'This is the original.';
SET @v1 += ' More text.';
PRINT @v1;
Here is the result set.
This is the original. More text.