22,209
社区成员
发帖
与我相关
我的任务
分享
select square(a) + b/c + d*e + (f + power(c, d))
from m;
go
if OBJECT_ID('test')is not null
drop table test
go
create table test(
a int,
b int,
c int,
d int,
e int,
f int
)
go
insert test
select 1,2,4,3,5,6 union all
select 2,3,1,6,5,7
--如果是处理表里的数据:
select a*a+c/b+d*e+f+c*c*c as value from test
/*
value
88
42
*/
go
if OBJECT_ID('pro_tracy')is not null
drop proc pro_tracy
go
create proc pro_tracy
@a int,@b int,@c int,@d int,@e int,@f int
as
select @a*@a+@c/@b+@d*@e+@f+@c*@c*@c as total
exec pro_tracy 1,2,4,3,5,6
/*
total
88
*/