You are on page 1of 1

CHARACTER CODES STRING EXTRACTION STRING MANIPULATION

PATINDEX ('%pattern%' , ‘A’)


ASCII (‘C’) SUBSTRING (‘A’, start, length) CONCAT (‘A’, ‘B’ [,‘C’])
Returns starting position of the first occurrence
Returns the ASCII code value of the leftmost of a %pattern% in string ‘A’ Returns L characters of ‘A’ starting at S Returns a string that is the result of
character of ‘С’ PATINDEX('H','HELLO') = 0 concatenating two or more string values
SUBSTRING('HELLOW',2,1) = 'E'
ASCII ('A') = 65 PATINDEX('H%','HELLO') = 1 SUBSTRING('HELLOW',5,10) = 'OW' CONCAT('HELLO')=ERROR
ASCII ('BEE') = 66 PATINDEX('%L_%','HELLO') = 3 SUBSTRING('HELLOW',10,1) = '' CONCAT(NULL, NULL)= ''
PATINDEX('%L_','HELLO') = 4 SUBSTRING('HELLOW',0,1) = '' CONCAT('HI',' ','WORLD')='HI WORLD'
CHAR (A) PATINDEX ('Z','HELLO') = 0 SUBSTRING('HELLOW',1,0) = '' CONCAT(12,NULL,34) = '1234'
PATINDEX('%A[0-9]%','AA1A') = 2 CONCAT(2014,12,31) = '20141231'
Converts an integer ASCII code A to a character
CHAR (65) = 'A'
PATINDEX('%L[^L]%','HELLO') = 4 LEFT (‘A’, B) / RIGHT (‘A’, B)
CHAR (1000) = NULL Returns the left/right part of ‘A’ with the LOWER (‘A’) / UPPER (‘A’)
STUFF (‘A’, S, L, ‘B’) specified number B Makes ‘A’ lowercase/uppercase
Replaces L characters of ‘A’ starting at S with ‘B’ RIGHT ('', 1) = ''
UNICODE (A) LOWER ('HI') = 'hi'
STUFF('HELLOW',2,5,'I') = 'HI' LEFT ('HI', 0) = '' UPPER ('hi') = 'HI'
Returns the int value for the first character of ‘A’ STUFF('HELLOW',2,15,'I') = 'HI' RIGHT ('HI', 3) = 'HI'
UNICODE('A') = 65 STUFF('HELLOW',20,1,'I') = NULL RIGHT ('HELLOW WORLD',5) = 'WORLD'
LEFT ('HELLOW WORLD', 6) = 'HELLOW' LTRIM (‘A’) / RTRIM (‘A’)
STUFF('HELLOW',0,1,'I') = NULL
NCHAR (A) STUFF('HELLOW',1,0,'I') = 'IHELLOW' Returns ‘A’ removing leading/trailing blanks
Returns the Unicode character with the specified STRING GENERATION
SOUNDEX & OTHER
LTRIM (' HI ') = 'HI '
integer code A LTRIM (' ') = ''
NCHAR (66000) = NULL SPACE (A) RTRIM(' HI ') = ' HI'
NCHAR (8) = '' SOUNDEX (‘A’) Returns a string of A spaces
NCHAR ('8') = ''
Returns a four-character (SOUNDEX) code to SPACE(2) = ' ' QUOTENAME (‘A’, [‘B’])
evaluate the similarity of two strings
SEARCH & REPLACE
Makes ‘A’ a valid SQL Server using ‘B’ delimiter
SOUNDEX ('Smith') = 'S530' REPLICATE (‘A’, B) QUOTENAME('TB NAME')=[TB NAME]
SOUNDEX ('Smythe') = 'S530'
Repeats a string value ‘A’ specified number of QUOTENAME('TB NAME', '] ')=[TB NAME]
CHARINDEX (‘A’, ‘B’, [, S])
times B QUOTENAME('TB NAME', '"')="TB NAME"
Searches ‘B’ for ‘A’ and returns its starting DIFFERENCE (‘A’, ‘B’) REPLICATE ('0', 4) = '0000' QUOTENAME('abc[]def')=[abc[]]def]
position if found. The search starts at S REPLICATE ('-', 0) = '' QUOTENAME('TB NAME', '''')='TB NAME'
Returns an integer value that indicates the
CHARINDEX ('Z', 'HELLO') = 0 REPLICATE ('-', NULL) = NULL
difference between the SOUNDEX of ‘A’ and ‘B’
CHARINDEX ('H', 'HELLO') = 1
DIFFERENCE('GREEN','GREENE') = 4 REVERSE (‘A’)
CHARINDEX ('OR', 'WORLD') = 2 STR (A [,length [, decimal]])
CHARINDEX ('L', 'HELLO', 4) = 4 Returns the reverse order of a string value
LEN (‘A’) Converts A number to string
REVERSE('HELLOW') = 'WOLLEH'
STR (2.234) = ' 2'
REPLACE (‘A’, ‘B’, ‘C’) Returns length of ‘A’, excluding trailing blanks STR (2.234, 4) = ' 2' REVERSE(12) = 21
LEN ('HELLOW WORD') = 11 STR (2.234, 4, 2) = '2.23'
Replaces in ‘A’ all occurrences of string ‘B’ with STR (2.234, 6, 2) = ' 2.23'
LEN ('HELLOW ') = 6
string ‘С’ LEN (12) = 2
REPLACE('HELLOW',NULL,'')=NULL LEN ('') = 0
REPLACE('HELLOW','','_')='HELLOW'
REPLACE('HELLOW','ELLOW','I')='HI'
REPLACE('HELLOW','L',1) = 'HE11OW'

You might also like