-1

我有一张这样的桌子

    CREATE TABLE [dbo].[tbl_JackUpRigs](
    [ID] [int] IDENTITY(600000,1) NOT NULL,
    [Company] [nvarchar](500) NULL,
    [Rig] [nvarchar](500) NULL,
    [Type] [nvarchar](200) NULL,
    [MaxWD] [float] NULL,
    [MaxDD] [float] NULL,
    [Operator] [nvarchar](500) NULL,
    [Location] [nvarchar](200) NULL,
    [ContractStatus] [nvarchar](100) NULL,
    [OPStatus] [nvarchar](100) NULL,
    [TopDrive] [nvarchar](200) NULL,
    [Country] [nvarchar](50) NULL,
    [CreatedDate] [datetime] NULL,
    [CreatedByID] [int] NULL,
    [CreatedByName] [nvarchar](50) NULL,
    [RigType] [nvarchar](50) NULL,
 CONSTRAINT [PK_tbl_Rigs] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

如您所见,设置为浮动的 MaxDD 列。现在,当我从该表中检索值时,我想将它们四舍五入为 1000。如果值为 25000,我希望得到 25,000。我很困惑我怎么能实现这个?

4

2 回答 2

2
SELECT CONVERT(varchar(100), CAST(25000000 AS money), 1)

或者

SELECT CONVERT(varchar(100), CAST(columnname AS money), 1)
于 2013-08-27T13:59:50.147 回答
0
select replace(convert(varchar,cast(1234567 as money),1), '.00','')
于 2013-08-27T14:03:29.463 回答