关于sql2000里建立自定义函数的问题
sql2000里建立自定义函数的我根本不明白是怎么回事情比如这个
CREATE FUNCTION GetClassName(@ClassID as int, @ClassType as int)
RETURNS nvarchar(100) as
begin
declare @ClassName as nvarchar(100)
set @ClassName = ''
if(@ClassType = 0)
begin
SELECT @ClassName = LngName FROM LXBIZ_Language WHERE (LngTypeID = @ClassID)
end
if(@ClassType = 1)
begin
SELECT @ClassName = CategoryName FROM LXBIZ_Category WHERE (CategoryID = @ClassID)
end
if(@ClassType = 2)
begin
SELECT @ClassName = ClassName FROM LXBIZ_BigClass WHERE (ClassID = @ClassID)
end
if(@ClassType = 3)
begin
SELECT @ClassName = SubClassName FROM LXBIZ_SubClass WHERE (SubClassID = @ClassID)
end
if(@ClassType = 4)
begin
SELECT @ClassName = CountryName FROM LXBIZ_Country WHERE (CountryID = @ClassID)
end
if(@ClassType = 5)
begin
SELECT @ClassName = ProvinceName FROM LXBIZ_Province WHERE (ProvinceID = @ClassID)
end
if(@ClassType = 6)
begin
SELECT @ClassName = CityName FROM LXBIZ_City WHERE (CityID = @ClassID)
end
return @ClassName
end
请大家指教以下