الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

بعض الدوال التي تتعامل مع ال String في ال SQL SERVER 2005

مغلق
بدأه رجل القمر في 24 نوفمبر 2006 · 1 رد · 559 مشاهدة · في قواعد بيانات Microsoft SQL Server
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

(1) Returns the left part of a character string with

the specified number of characters

هنا نختار اسم العمود وعدد الاحرف التي نريدها من كل اسم

LEFT ( character_expression , integer_expression )

# Examples :

select left(author_name,3) from ta_author

# Resulte :

ali

sal

gog

Source :

ali

saleh

gogo

------------------------------------------------------------------

(2) Returns the number of characters, instead of the number of

bytes, of the specified string expression, excluding trailing

blanks.

على نفس المثال السابق هذه الدالة تعطينا عدد أحرف محتويات كل عمود فمثلا لو كان عندنا عمود أسماء الطلاب وكان لدينا الطلاب الثلاثة السابقين في المثال السابق فإننا نحصل على عدد أحرف كل اسم طالب

select len(author_name) from ta_author

# Examples :

3

5

4

------------------------------------------------------------------

(3) Returns a character expression after it removes leading blanks

LTRIM ( character_expression )

لدمج السلاسل النصية مع بعضها

# Examples :

DECLARE @string_to_trim varchar(60)
SET @string_to_trim = '     Five spaces are at the beginning of this string.'
SELECT 'Here is the string without the leading spaces: ' +  LTRIM(@string_to_trim)

# Resulte :

Here is the string without the leading spaces: Five spaces are at the beginning of this string

------------------------------------------------------------------

(4) Returns the integer value, as defined by the Unicode standard, for the first character of the input expression

UNICODE ( 'ncharacter_expression' )

هذه الدالة تعطي شفرة الـ ASCII للحرف الأول من الكلمة أو بمعنى أصح للحرف

# Examples :

declare @a nvarchar(50)

set @a = 'srgergerg'

select unicode(@a)

# Resulte:

115

------------------------------------------------------------------

(5) Returns a string of repeated spaces

SPACE ( integer_expression )

الدالة التالية تعطينا إمكانية إضافة عدد من الخانات الفارغة نقوم بتحديدها كبارامتر

# Examples :

select [last name] + ',' + space(2) + [first name] from [name]

# Resulte :

jbu, hiho

omar, ali

dodo, koko

تم تعديل هذه المشاركة بواسطة walcom في 26 نوفمبر 2006 في 10:11

#2

جزاك الله خير والله

سأل الممكن المستحيل اين تسكن؟ قال في عقول الضعفاء

اشهد أن لا اله الا الله و اشهد أن محمداًً رسول الله

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…