Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
User-Defined string Functions Transact-SQL
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
User-Defined string Functions Transact-SQL
Divers
Thread ID:
01037259
Message ID:
01037259
Vues:
86
Ladies and Gentlemen,

I am pleased to offer, free of charge, the following string functions Transact-SQL:

AT(): Returns the beginning numeric position of the nth occurrence of a character expression within another character expression, counting from the leftmost character.
RAT(): Returns the numeric position of the last (rightmost) occurrence of a character string within another character string.
OCCURS(): Returns the number of times a character expression occurs within another character expression (including overlaps).
OCCURS2(): Returns the number of times a character expression occurs within another character expression (excluding overlaps).
PADL(): Returns a string from an expression, padded with spaces or characters to a specified length on the left side.
PADR(): Returns a string from an expression, padded with spaces or characters to a specified length on the right side.
PADC(): Returns a string from an expression, padded with spaces or characters to a specified length on the both sides.
CHRTRAN(): Replaces each character in a character expression that matches a character in a second character expression with the corresponding character in a third character expression.
STRTRAN(): Searches a character expression for occurrences of a second character expression, and then replaces each occurrence with a third character expression. Unlike a built-in function Replace, STRTRAN has three additional parameters.
STRFILTER(): Removes all characters from a string except those specified.
GETWORDCOUNT(): Counts the words in a string.
GETWORDNUM(): Returns a specified word from a string.
PROPER(): Returns from a character expression a string capitalized as appropriate for proper names.
RCHARINDEX(): Similar to the Transact-SQL function Charindex, with a Right search.
ARABTOROMAN(): Returns the character Roman numeral equivalent of a specified numeric expression (from 1 to 3999).
ROMANTOARAB(): Returns the number equivalent of a specified character Roman numeral expression (from I to MMMCMXCIX).

AT, PADL, PADR, CHRTRAN, PROPER: Similar to the Oracle functions PL/SQL INSTR, LPAD, RPAD, TRANSLATE, INITCAP.

More than 4000 people have already downloaded my functions. I hope you will find them useful as well.

For more information about string UDFs Transact-SQL please visit the
http://www.levelextreme.com/ViewPageNewDownload.aspx?ID=27115

With the best regards.
_________________________________________________________________
BTW MS SQL 2000 SP 4 bug
-- I did run this example and validated the erroneous result
declare @n nvarchar(4000)
set @n = replicate(N'z',3999)+N'i'
select right(replace(@n, N'i', N'B'),1) -- display i but this is incorrect result, correct result is B

-- Here is my information:
SELECT SERVERPROPERTY('Edition') -- display Desktop Engine
SELECT SERVERPROPERTY('ProductLevel') -- display SP4
SELECT SERVERPROPERTY('ProductVersion') -- display 8.00.2039
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform