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')
解决方案 »
- 我的一个工资表不知是属什么问题了..高手们帮我看一下
- datetime类型怎么取时分秒
- 请问我用sql2005做备份, 有没有办法可以用sql2000恢复? 多谢!
- 请问能否用一语SQL语句把一个表中最后一行的内容获取出来呢?
- 一个很有意思的SQL语句问题
- 如何获得当前连接本地Sql Server的所有连接信息?
- 存储过程的问题
- SQL 数据表重新创建后,表约束,触发器的创建
- 一道选择题??
- 高分请教高手,在线等待!
- 事务复制问题,报:General network error. Check your network documentation.大家来帮忙呀
- 求解SQL SERVER 分布式问题
太感谢了... 我怎么给分你啊?我刚来报道,不懂得操作哦。