Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating function
Message
From
08/02/2004 05:21:53
Larry Santos
Local Data System
Philippines
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Creating function
Miscellaneous
Thread ID:
00875246
Message ID:
00875246
Views:
53
Hi,

i have code and is return zero, what do i miss to my code?

alter FUNCTION RET_xxx (@val varchar(20))
returns varchar
AS

begin
declare @ret varchar(20)
IF LEN(@val) = 1
set @ret= '0000'+@val
ELSE IF LEN(@val) = 2
set @ret= '000'+@val
ELSE IF LEN(@val) = 3
set @ret= '00'+@val
ELSE IF LEN(@val) >= 4
set @ret= '0'+@val
RETURN(@ret)
end

TIA
Next
Reply
Map
View

Click here to load this message in the networking platform