查询自定义函数关于decimal类型
CREATE function test2()
Returns @temptable Table(RowID int identity(1,1) not null,aa decimal,bb decimal)
AS
begin
insert into @temptable select aa ,bb from cc
return
end
上面的自定义含义查询语句如下
select aa,bb from test2()
为什么这里查出来的aa,bb变成整型了变成 0,3 ,而不是decimal类型,(直接select aa ,bb from cc ,cc表中 aa ,bb 是decimal类型 分别0.00,2.75)
CREATE function test2()
Returns @temptable Table(RowID int identity(1,1) not null,aa decimal,bb decimal)
AS
begin
insert into @temptable select aa ,bb from cc
return
end
上面的自定义含义查询语句如下
select aa,bb from test2()
为什么这里查出来的aa,bb变成整型了变成 0,3 ,而不是decimal类型,(直接select aa ,bb from cc ,cc表中 aa ,bb 是decimal类型 分别0.00,2.75)
Returns @temptable Table(RowID int identity(1,1) not null,aa decimal(10,5),bb decimal(10,5))
AS
begin
insert into @temptable select aa ,bb from cc
return
end
改成想要的精度看看
Returns @temptable Table(RowID int identity(1,1) not null,aa decimal(8,2),bb decimal(8,2))
AS
begin
insert into @temptable select aa ,bb from cc
return
end 成交。