preview

Wild Card Essay

Decent Essays

DECLARE @v1 varchar(40); SET @v1 = 'This is the original.'; SET @v1 += ' More text.'; PRINT @v1; % (Wildcard - Character(s) to Match) Matches any string of zero or more characters. This wildcard character can be used as either a prefix or a suffix. The following example returns all the first names of people in the Person table of AdventureWorks2012 that start with Dan. SELECT FirstName, LastName FROM Person.Person WHERE FirstName LIKE 'Dan%'; GO [ ] (Wildcard - Character(s) to Match) Matches any single character within the specified range or set that is specified between brackets [ ]. These wildcard characters can be used in string comparisons that involve pattern matching, such as LIKE and PATINDEX. The following …show more content…

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). Transact-SQL provides the following compound operators: Operator Link to more information Action += += (Add EQUALS) (Transact-SQL) Adds some amount to the original value and sets the original value to the result. -= -= (Subtract EQUALS) (Transact-SQL) Subtracts some amount from the original value and sets the original value to the result. *= *= (Multiply EQUALS) (Transact-SQL) Multiplies by an amount and sets the original value to the result. /= (Divide EQUALS) (Transact-SQL) Divides by an amount and sets the original value to the result. %= Modulo EQUALS (Transact-SQL) Divides by an amount and sets the original value to the modulo. &= &= (Bitwise AND EQUALS) (Transact- SQL) Performs a bitwise AND and sets the original value to the result. ^= ^= (Bitwise Exclusive OR EQUALS) (Transact-SQL) Performs a bitwise exclusive OR and sets the original value to the result. |= |= (Bitwise OR EQUALS) (Transact- SQL) Performs a bitwise OR and sets the original value to the result. Operator Precedence When a complex expression has multiple operators, operator precedence determines the sequence in which the operations are performed. The order of execution can significantly affect the resulting value.+

Get Access