If you want this function to be in sql 2000, then you should go for what khtan has suggested.
Replace select case with
IF ELSE like:
IF @VAL IS NULL
BEGIN
-- MESSAGE 'GenerateControlValueChar = NULLE'
@ret = 0
END
ELSE
BEGIN
@i = 1
@taille = LENGTH(@val)
@ret = 0

I agree, adriaan.
I think it will be better if the original posterr posts his requirement and clarify what his function is suppose to do.
I think he is checking, whetherr the value is null or not and if null calling another function to convert it to varchar.
This can be achived inside procedure itself without having to do this function call.

Thanks for your response. Function modified by you is working fine. After that fuction, there is another function is making call to first one. Here is the second function. Buts its giving error. COrrect me on this.

Is it not a best time to go thru SQL Server books online for all the bits and pieces [<img src='/community/emoticons/emotion-1.gif' alt='' />].<br /><br /><hr noshade size="1"><b>Satya SKJ</b><br />Microsoft SQL Server MVP<br />Contributing Editor & Forums Moderator<br /<a target="_blank" href=http://www.SQL-Server-Performance.Com>http://www.SQL-Server-Performance.Com</a><br /><center><font color="teal"><font size="1">This posting is provided AS IS with no rights for the sake of <i>knowledge sharing.</i></font id="size1"></font id="teal"></center>