udf function not returnint proper value
-
9 марта 2011 г. 15:11
I am trying to create a simple function to return a string value but the problem it returns only 1 char instead of the full work
[code]
-- Declare the return variable here
DECLARE @mois nvarchar(10)
-- Add the T-SQL statements to compute the return value hereRETURN CASE @inMth
WHEN 'Jan' THEN 'Janvier'
WHEN 'Feb' THEN 'Fevrier'
WHEN 'Mar' THEN 'Mars'
WHEN 'Apr' THEN 'Avril'
WHEN 'May' THEN 'Mai'
WHEN 'Jun' THEN 'Juin'
WHEN 'Jul' THEN 'Juillet'
WHEN 'Aug' THEN 'Aout'
WHEN 'Sep' THEN 'Septembre'
WHEN 'Oct' THEN 'Octobre'
WHEN 'Nov' THEN 'Novembre'
WHEN 'Dec' THEN 'Decembre'
END-- Return the result of the function
RETURN @mois
[/code]when I run the following I get J as the returm value
select
@m= dbo.udf_TranslateMonthToFrench('Jan')
print @mThanks
Все ответы
-
1 апреля 2011 г. 19:10
Hi Alabil,
Please could you post the whole function declaration, including the function header and the line where you declare @inMth
Thanks.
Peter Carter-Greenan http://sqlserverdownanddirty.blogspot.com/ -
5 мая 2011 г. 15:20
make sure the returned type is right
RETURNS NVARCHAR(10)
- Предложено в качестве ответа StefDBA 5 мая 2011 г. 15:21
- Помечено в качестве ответа Mr. WhartyMicrosoft Community Contributor, Moderator 25 мая 2012 г. 4:39

