Please Help me, I Got Error : Argument data type int is invalid for argument 2 of format function in Query SQL SERVER

Rizal Valry 196 Reputation points
2021-09-12T04:35:07.48+00:00

131314-typedata.png131207-saldo-awal.png

I use the following query :

SELECT
saldoawal.id,
format(saldoawal.saldo_awal,0) AS saldoAwal,
format(saldoawal.bayar_ke_vendor,0) AS byrKeVendor,
format(saldoawal.tagihan_ke_nasabah,0) AS tagKeNasabah,
format(saldoawal.akhir,0) AS salAkhir
FROM
vm.saldoawal
WHERE
saldoawal.record_code = '1' AND
saldoawal.code = '980001'

and get error message :
Msg 8116, Level 16, State 1, Line 1
Argument data type int is invalid for argument 2 of format function.

Completion time: 2021-09-12T11:33:24.9509126+07:00

Developer technologies Transact-SQL
SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. Rizal Valry 196 Reputation points
    2021-09-12T04:47:12.357+00:00

    Sorry, I Have Solution from my questions guys
    hehe

    I just need to change parameter 0 to 'N0' and it's what I expected :)

    Like This :
    SELECT
    saldoawal.id,
    format(saldoawal.saldo_awal,'N0') AS saldoAwal,
    format(saldoawal.bayar_ke_vendor,'N0') AS byrKeVendor,
    format(saldoawal.tagihan_ke_nasabah,'N0') AS tagKeNasabah,
    format(saldoawal.akhir,'N0') AS salAkhir
    FROM
    vm.saldoawal
    WHERE
    saldoawal.record_code = '1' AND
    saldoawal.code = '980001'

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.