add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
/*
ok, someone sent me to this db<>fiddle page, now what?
The purpose of this is to make it easy for people to
understand your schema and data so they don't have to
spend time figuring that out, and can instead focus
on your issue.
So put some create tables etc. here:
*/

CREATE TABLE [dbo].[X](
[VALUE_A] [bigint] NULL,
[VALUE_B] [bigint] NULL,
[ID] [varchar](max) NULL,
)
/*
And some sample data, including edge cases:
*/

INSERT INTO X VALUES (2031323,22,1)
INSERT INTO X VALUES (3371331,75,1)
INSERT INTO X VALUES (4399213,52,1)
INSERT INTO X VALUES (4910001,46,1)
INSERT INTO X VALUES (2163036,38,1)
INSERT INTO X VALUES (1514817,91,1)
INSERT INTO X VALUES (2786338,36,1)
INSERT INTO X VALUES (3724760,35,1)
INSERT INTO X VALUES (3769556,13,1)
INSERT INTO X VALUES (3812410,28,1)
INSERT INTO X VALUES (4415600,54,1)
INSERT INTO X VALUES (1018894,95,1)
INSERT INTO X VALUES (3870688,43,1)
INSERT INTO X VALUES (3702609,87,1)
INSERT INTO X VALUES (3410337,79,1)
28 rows affected
SELECT
SUM(CONVERT(decimal(15, 4), CONVERT(varchar(10), VALUE_A) + '.' + CONVERT(varchar(4), VALUE_B) + '00'))
FROM X
WHERE ID = 1
(No column name)
82883234.5800
68220986.6800
Msg 102 Level 15 State 1 Line 1
Incorrect syntax near '68220986.6800'.
/* for more info: https://sqlblog.org/ask */