Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating function
Message
From
09/02/2004 06:13:58
 
 
To
08/02/2004 05:21:53
Larry Santos
Local Data System
Philippines
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00875246
Message ID:
00875381
Views:
19
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
Previous
Reply
Map
View

Click here to load this message in the networking platform