MS SQL Server String capacities can be applied on string esteem or will restore string esteem or numeric information.
Following is the rundown of String capacities with models.
ASCII()
Ascii code worth will come as yield for a character articulation.
Example
The accompanying inquiry will give the Ascii code estimation of a given character.
Select ASCII ('word')
CHAR()
Character will come as yield for given Ascii code or whole number.
Example
The accompanying inquiry will give the character for a given whole number.
Select CHAR(97)
NCHAR()
Unicode character will come as yield for a given whole number.
Example
The accompanying inquiry will give the Unicode character for a given whole number.
Select NCHAR(300)
CHARINDEX()
Beginning situation for given inquiry articulation will come as yield in a given string articulation.
Example
The accompanying question will give the beginning situation of 'G' character for given string articulation 'Lord'.
Select CHARINDEX('G', 'KING')
LEFT()
Left piece of the given string till the predefined number of characters will come as yield for a given string.
Example
The accompanying question will give the 'WORL' string as referenced 4 number of characters for given string 'WORLD'.
Select LEFT('WORLD', 4)
RIGHT()
Right piece of the given string till the predetermined number of characters will come as yield for a given string.
Example
The accompanying inquiry will give the 'DIA' string as referenced 3 number of characters for given string 'INDIA'.
Select RIGHT('INDIA', 3)
SUBSTRING()
A piece of a string dependent on the beginning position worth and length worth will come as yield for a given string.
Example
The accompanying inquiries will give the 'WOR', 'DIA', 'ING' strings as we referenced (1,3), (3,3) and (2,3) as start and length esteems individually for given strings 'WORLD', 'INDIA' and 'Lord'.
Select SUBSTRING ('WORLD', 1,3)
Select SUBSTRING ('INDIA', 3,3)
Select SUBSTRING ('KING', 2,3)
LEN()
Number of characters will come as yield for a given string articulation.
Example
The accompanying inquiry will give the 5 for the 'Welcome' string articulation.
Select LEN('HELLO')
LOWER()
Lowercase string will come as yield for a given string information.
Example
The accompanying inquiry will give the 'sqlserver' for the 'SQLServer' character information.
Select LOWER('SQLServer')
LOWER()
Capitalized string will come as yield for a given string information.
Example
The accompanying inquiry will give the 'SQLSERVER' for the 'SqlServer' character information.
Select LOWER('SQLServer')
UPPER()
String articulation will come as yield for a given string information in the wake of eliminating driving spaces.
Example
The accompanying inquiry will give the 'WORLD' for the ' WORLD' character information.
Select UPPER('SqlServer')
LTRIM()
String articulation will come as yield for a given string information in the wake of eliminating following spaces.
Example
The accompanying inquiry will give the 'INDIA' for the 'INDIA ' character information.
Select LTRIM(' WORLD')
RTRIM()
String articulation will come as yield for a given string information in the wake of supplanting all events of determined character with indicated character.
Example
The accompanying inquiry will give the 'KNDKA' string for the 'INDIA' string information.
Select REPLACE('INDIA', 'I', 'K')
REPLICATE()
Rehash string articulation will come as yield for a given string information with determined number of times.
Example
The accompanying inquiry will give the 'WORLDWORLD' string for the 'WORLD' string information.
Select REPLICATE('WORLD', 2)
REVERSE()
Invert string articulation will come as yield for a given string information.
Example
The accompanying inquiry will give the 'DLROW' string for the 'WORLD' string information.
Select REVERSE('WORLD')
SOUNDEX()
Returns four-character (SOUNDEX) code to assess the likeness of two given strings.
Example
The accompanying inquiry will give the 'S530' for the 'Smith', 'Smyth' strings.
Select SOUNDEX('Smith'), SOUNDEX('Smyth')
DIFFERENCE()
Number worth will come as yield of given two articulations.
Example
The accompanying question will give the 4 for the 'Smith', 'Smyth' articulations.
Select Difference('Smith','Smyth')
Note − If the yield esteem is 0 it shows frail or no comparability between give 2 articulations.
SPACE()
String will come as yield with the predetermined number of spaces.
Example
The accompanying question will give the 'I LOVE INDIA'.
Select 'I'+space(1)+'LOVE'+space(1)+'INDIA'
STUFF()
String articulation will come as yield for a given string information subsequent to supplanting from beginning character till the predetermined length with determined character.
Example
The accompanying question will give the 'AIJKFGH' string for the 'ABCDEFGH' string information according to given beginning character and length as 2 and 4 separately and 'IJK' as determined objective string.
Select STUFF('ABCDEFGH', 2,4,'IJK')
STR()
Character information will come as yield for the given numeric information.
Example
The accompanying question will give the 187.37 for the given 187.369 dependent on indicated length as 6 and decimal as 2.
Select STR(187.369,6,2)
UNICODE()
Number worth will come as yield for the main character of given articulation.
Example
The accompanying question will give the 82 for the 'RAMA' articulation.
Select UNICODE('RAMA')
QUOTENAME()
Given string will come as yield with the predetermined delimiter.
Example
The accompanying question will give the "RAMA" for the given 'RAMA' string as we indicated twofold statement as delimiter.
Select QUOTENAME('RAMA','"')
PATINDEX()
Beginning situation of the primary event from the given articulation as we determined 'I' position is required.
Example
The accompanying question will give the 1 for the 'INDIA'.
Select PATINDEX('I%','INDIA')
FORMAT()
Given articulation will come as yield with the predetermined organization.
Example
The accompanying question will give the ' Monday, November 16, 2015' for the getdate work according to determined configuration with 'D' alludes work day name.
SELECT FORMAT ( getdate(), 'D')
CONCAT()
Single string will come as yield subsequent to linking the given boundary esteems.
Example
The accompanying inquiry will give the 'A,B,C' for the given boundaries.
Select CONCAT('A',',','B',',','C')