-- ============================================= -- Author: T.O.P -- Create date: 2009/11/24 -- Version: SQL SERVER 2005 -- ============================================= declare @TB table([A] int) insert @TB select 852 union all select 150 union all select 1755select FLOOR(A/10.0)*10 AS A from @TB --测试结果: /* A --------------------------------------- 850 150 1750(3 row(s) affected)*/
---测试数据--- if object_id('[tb]') is not null drop table [tb] go create table [tb]([col] int) insert [tb] select 852 union all select 150 union all select 17555
---查询--- select col/10*10 as col from tb---结果--- col ----------- 850 150 17550(所影响的行数为 3 行)
-- =============================================
-- Author: T.O.P
-- Create date: 2009/11/24
-- Version: SQL SERVER 2005
-- =============================================
declare @TB table([A] int)
insert @TB
select 852 union all
select 150 union all
select 1755select FLOOR(A/10.0)*10 AS A
from @TB
--测试结果:
/*
A
---------------------------------------
850
150
1750(3 row(s) affected)*/
if object_id('[tb]') is not null drop table [tb]
go
create table [tb]([col] int)
insert [tb]
select 852 union all
select 150 union all
select 17555
---查询---
select col/10*10 as col from tb---结果---
col
-----------
850
150
17550(所影响的行数为 3 行)