create table a(name varchar(20),unit int)
insert into a select 'us',8
insert into a select 'RMB',1
insert into a select 'HK Dollar',2
select * from a
alter function caculate(@num int,@name varchar(20))
RETURNS int
as
Begin
declare @Currency int
select @Currency = @num*unit from a where name = @name
return @Currency
end
select dbo.caculate(8,'HK Dollar')
insert into a select 'us',8
insert into a select 'RMB',1
insert into a select 'HK Dollar',2
select * from a
alter function caculate(@num int,@name varchar(20))
RETURNS int
as
Begin
declare @Currency int
select @Currency = @num*unit from a where name = @name
return @Currency
end
select dbo.caculate(8,'HK Dollar')
太感谢了... 我怎么给分你啊?我刚来报道,不懂得操作哦。