本文介绍了如何编写用户定义的函数以转换为大写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写用户定义的函数以将任何案例转换为uppe r case



我尝试过:



创建函数get_Name3(@Name varchar)

返回varchar(50)

as

begin

声明@OutputName varchar(50)

set @ OutputName =(从大写中选择upper(Name),其中Name = @ name)

return @OutputName

end

select * from dbo.get_Name1('Akhila ')作为名称

how to write the user defined function to turn any case into upper case

What I have tried:

create function get_Name3(@Name varchar)
returns varchar(50)
as
begin
declare @OutputName varchar(50)
set @OutputName=(select upper(Name) from uppercase where Name=@name)
return @OutputName
end
select * from dbo.get_Name1('Akhila') as Name

推荐答案

select dbo.get_Name1('Akhila') as Name





如果你想从一个表中得到上层的东西那将是b / b




if you want to upper class things from a table it would be

select dbo.get_Name1(FieldName) as FieldName from MyTable


SELECT UPPER(LastName) + ', ' + FirstName AS Name
FROM Person.Person


这篇关于如何编写用户定义的函数以转换为大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 02:13