首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

在SQL Server的新建查询中运行下面的语句,得到的结果是(),该如何处理

2012-05-23 
在SQL Server的新建查询中运行下面的语句,得到的结果是()create table numbers(n1 int,n2 numberic(5,0),n

在SQL Server的新建查询中运行下面的语句,得到的结果是()
create table numbers
(
n1 int,
n2 numberic(5,0),
n3 numberic(4,2)
)
go


insert numbers values(1.5,1.5,1.5)
select *
from numbers
go

答案是1、2和1.50的结果集,我想问的是那个2怎么来的?

[解决办法]
四舍五入

SQL code
select cast(1.4 as numeric(5,0)) as num1,cast(1.5 as numeric(5,0)) as num2/**num1                                    num2--------------------------------------- ---------------------------------------1                                       2(1 行受影响)**/ 

热点排行