create function Fun12(@InsCd varchar)
returns varchar(100)
as
begin
declare @ret varchar(52)
set @ret = (select [InsName] from [Assignment4].[dbo].[1466]
where rtrim(ltrim([InsCd]))= @InsCd)
return @ret
end
Executing:
declare @r varchar(50)
exec @r = dbo.Fun12 '436'
select @r
I am getting NULL value.
Could any one please help me finding the error?
You need to specify a size for your parameter
@InsCd.Some thing like this but you might want to use another value than
20depending on the size of fieldInsCd.