Dize Değerleri Üzerinde İşlevler - büyük harf

Şunlar için geçerlidir: SQL Server

Bu fonksiyon, $arg içindeki her karakteri büyük harfine dönüştürür. Unicode kod noktaları için Microsoft Windows ikili harf dönüşümü, karakterlerin nasıl büyük harfe dönüştürüldüğünü belirtir. Bu standart, Unicode standart kod noktası standardı için eşlemeden farklıdır.

Syntax

  
fn:upper-case($arg as xs:string?) as xs:string  

Arguments

Süre Definition
$arg Dize değeri büyük harfe dönüştürülür.

Remarks

Eğer $arg değeri boşsa, sıfır uzunlukta bir dizi döner.

Examples

A. Bir teli büyük harfe değiştirmek

Aşağıdaki örnek, 'abcDEF!@4' giriş dizisini büyük harflere çevirir.

DECLARE @x xml = N'abcDEF!@4';  
SELECT @x.value('fn:upper-case(/text()[1])', 'nvarchar(10)');  

B. Belirli bir karakter dizisi araması

Bu örnek, büyük harf fonksiyonunun büyük harf fonksiyonunun büyük harf hassasiyeti olmayan bir arama yapılmasını nasıl yapacağınızı gösterir.

USE AdventureWorks2022;
GO  
--WITH XMLNAMESPACES clause specifies the namespace prefix  
--to use.   
WITH XMLNAMESPACES ('https://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription' AS pd)  
--The XQuery contains() function is used to determine whether  
--any of the text nodes below the <Summary> element contain  
--the word 'frame'. The upper-case() function is used to make  
--the search case-insensitive.  
  
SELECT ProductModelID, CatalogDescription.query('  
      <Prod>  
         { /pd:ProductDescription/@ProductModelID }  
         { /pd:ProductDescription/pd:Summary }  
      </Prod>  
 ') as Result  
FROM Production.ProductModel  
where CatalogDescription.exist('  
/pd:ProductDescription/pd:Summary//text()[  
          contains(upper-case(.), "FRAME")]')  = 1  

Sonuç kümesi aşağıdadır.

ProductModelID Result

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

19 <Prod ProductModelID="19">

<pd:Summary xmlns:pd="https://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription">

<p1:p xmlns:p1="http://www.w3.org/1999/xhtml">Our top-of-the-line competition mountain bike.

Performance-enhancing options include the innovative HL Frame,

super-smooth front suspension, and traction for all terrain.

</p1:p>

</pd:Summary>

</Prod>

25 <Prod ProductModelID="25">

<pd:Summary xmlns:pd="https://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription">

<p1:p xmlns:p1="http://www.w3.org/1999/xhtml">This bike is ridden by race winners. Developed with the

Adventure Works Cycles professional race team, it has a extremely light

heat-treated aluminum frame, and steering that allows precision control.

</p1:p>

</pd:Summary>

</Prod>