Sql server® 2012 t-sql fundamentals



Download 10,93 Mb.
Pdf ko'rish
bet109/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   105   106   107   108   109   110   111   112   ...   443
Bog'liq
BookSQL

The 

LEFT

 and 

RIGHT

 Functions

The LEFT and RIGHT functions are abbreviations of the SUBSTRING function, returning a requested 

number of characters from the left or right end of the input string.

www.it-ebooks.info




 

CHAPTER 2

 

Single-Table Queries



 

 67

Syntax

LEFT(stringn), RIGHT(stringn)

The first argument, string, is the string the function operates on. The second argument, n, is the 

number of characters to extract from the left or right end of the string. For example, the following 

code returns the output ‘cde’.

SELECT RIGHT('abcde', 3);



The 

LEN

 and 

DATALENGTH

 Functions

The LEN function returns the number of characters in the input string.



Syntax

LEN(string)

Note that this function returns the number of characters in the input string and not necessarily 

the number of bytes. With regular characters, both numbers are the same because each character re-

quires one byte of storage. With Unicode characters, each character requires two bytes of storage (in 

most cases, at least); therefore, the number of characters is half the number of bytes. To get the num-

ber of bytes, use the DATALENGTH function instead of LEN. For example, the following code returns 5.

SELECT LEN(N'abcde');

The following code returns 10.

SELECT DATALENGTH(N'abcde');

Another difference between LEN and DATALENGTH is that the former excludes trailing blanks but 

the latter doesn’t.




Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   105   106   107   108   109   110   111   112   ...   443




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish