MS SQL Server String capacities can be connected on string esteem or will return string esteem or numeric information.

Following is the rundown of String capacities with precedents.

ASCII()

Ascii code esteem will come as yield for a character articulation.

Example

The accompanying question will give the Ascii code estimation of a given character.

Select ASCII ('word')

CHAR()

Character will come as yield for given Ascii code or number.

Example

The accompanying question will give the character for a given whole number.

Select CHAR(97)

NCHAR()

Unicode character will come as yield for a given number.

Example

The accompanying question will give the Unicode character for a given whole number.

Select NCHAR(300)

CHARINDEX()

Beginning position for given hunt articulation will come as yield in a given string articulation.

Example

The accompanying inquiry will give the beginning position of 'G' character for given string articulation 'KING'.

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 specified 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 made reference to 3 number of characters for given string 'INDIA'.

Select RIGHT('INDIA', 3)

SUBSTRING()

Some portion of a string dependent on the begin position esteem and length esteem will come as yield for a given string.

Example

The accompanying inquiries will give the 'WOR', 'DIA', 'ING' strings as we made reference to (1,3), (3,3) and (2,3) as begin and length esteems separately for given strings 'WORLD', 'INDIA' and 'KING'.

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 question 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')

UPPER()

Capitalized string will come as yield for a given string information.

Example

The accompanying question will give the 'SQLSERVER' for the 'SqlServer' character information.

Select UPPER('SqlServer')

LTRIM()

String articulation will come as yield for a given string information in the wake of evacuating driving spaces.

Example

The accompanying inquiry will give the 'WORLD' for the ' WORLD' character information.

Select LTRIM(' WORLD')

RTRIM()

String articulation will come as yield for a given string information in the wake of expelling trailing spaces.

Example

The accompanying inquiry will give the 'INDIA' for the 'INDIA ' character information.

Select RTRIM('INDIA ')

REPLACE()

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 question will give the 'KNDKA' string for the 'INDIA' string information.

Select REPLACE('INDIA', 'I', 'K')

REPLICATE()

Continue string articulation will come as yield for a given string information with indicated number of times.

Example

The accompanying question 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 similitude of two given strings.

Example

The accompanying question will give the 'S530' for the 'Smith', 'Smyth' strings.

Select SOUNDEX('Smith'), SOUNDEX('Smyth')

DIFFERENCE()

Number esteem will come as yield of given two articulations.

Example

The accompanying inquiry will give the 4 for the 'Smith', 'Smyth' articulations.

Select Difference('Smith','Smyth')

Note − If the yield esteem is 0 it demonstrates feeble or no likeness between give 2 articulations.

SPACE()

String will come as yield with the predefined number of spaces.

Example

The accompanying inquiry 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 in the wake of supplanting from beginning character till the predefined length with indicated character.

Example

The accompanying inquiry 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 target 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 determined length as 6 and decimal as 2.

Select STR(187.369,6,2)

UNICODE()

Number esteem will come as yield for the principal character of given articulation.

example

The accompanying inquiry will give the 82 for the 'RAMA' articulation.

Select UNICODE('RAMA')

QUOTENAME()

Given string will come as yield with the predefined 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 position of the main 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 arrangement.

Example

The accompanying inquiry will give the ' Monday, November 16, 2015' for the getdate work according to indicated organize with 'D' alludes weekday name.

SELECT FORMAT ( getdate(), 'D')

CONCAT()

Single string will come as yield subsequent to connecting the given parameter esteems.

Example

The accompanying inquiry will give the 'A,B,C' for the given parameters.