我有一张这样的表
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。我被迷惑了我怎么能做到这一点?
答案 0 :(得分:2)
SELECT CONVERT(varchar(100), CAST(25000000 AS money), 1)
或
SELECT CONVERT(varchar(100), CAST(columnname AS money), 1)
答案 1 :(得分:0)
select replace(convert(varchar,cast(1234567 as money),1), '.00','')