maqskywalker
asked on
displaying only 2 decimal places in a string field t-sql
i'm using sql server 2016.
I have a table that looks like this:
The data looks like this:
Here is script to create table:
How do i only display 2 decimal places in the [Score] column ?
I know that column should be decimal datatype.
But the existing table is varchar. I'm just querying an old table that was created like that.
I have a table that looks like this:
The data looks like this:
Here is script to create table:
USE [TestDatabase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TestScores1](
[RecordID] [int] NULL,
[Score] [varchar](50) NULL
) ON [PRIMARY]
GO
INSERT [dbo].[TestScores1] ([RecordID], [Score]) VALUES (1, N'100.00000')
GO
INSERT [dbo].[TestScores1] ([RecordID], [Score]) VALUES (2, N'94.00001')
GO
INSERT [dbo].[TestScores1] ([RecordID], [Score]) VALUES (3, N'86.12345')
GO
INSERT [dbo].[TestScores1] ([RecordID], [Score]) VALUES (4, N'76.05365')
GO
INSERT [dbo].[TestScores1] ([RecordID], [Score]) VALUES (5, N'88.04563')
GO
How do i only display 2 decimal places in the [Score] column ?
I know that column should be decimal datatype.
But the existing table is varchar. I'm just querying an old table that was created like that.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER