Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating function
Message
De
09/02/2004 06:13:58
 
 
À
08/02/2004 05:21:53
Larry Santos
Local Data System
Philippines
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00875246
Message ID:
00875381
Vues:
18
Larry,
alter FUNCTION RET_xxx (@val varchar(20),@max)
returns varchar(20) -- <======= !!!! use CHAR(5)
AS
 RETURN RIGHT('00000'+RTRIM(@val),5)
END
You can generalize 5 value to a parameters
alter FUNCTION RET_xxx (@val varchar(20),@maxlen TINYINT)
returns VARCHAR(<maxLenght>)
AS
 RETURN RIGHT(REPLICATE('0',@maxlen)+RTRIM(@val),@maxlen)
END
Fabio
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform