none
Error converting data type varchar to numeric RRS feed

  • Pertanyaan

  • saya mau tanya dong kaka yg baik...

    saya ada masalah dengan Error converting data type varchar to numeric.itu apa si

    exec sp_executesql N'SELECT [ItemID],'''' AS [SRGuarantorRuleType],CAST(''0,00'' AS NUMERIC(18, 2)) AS [AmountValue],CAST(''0'' AS BIT) AS [IsValueInPercent],CAST(''1'' AS BIT) AS [IsInclude],CAST(''0'' AS BIT) AS [IsGuarantor],CAST(''0'' AS NUMERIC(18, 2)) AS [BasicPrice],CAST(''0'' AS NUMERIC(18, 2)) AS [CoveragePrice]  FROM [Item] WHERE [ItemID] IN (''XX01'',''Ket10'',''Han03'',''Han03'',''Han03'') AND [IsActive] = @IsActive2 ORDER BY [ItemID] ASC',N'@IsActive2 bit',@IsActive2=1

    Jumat, 02 November 2012 04.04

Jawaban

  • Ada kesalahan penulisan tanda baca di query Anda: CAST(''0,00'' AS NUMERIC(18, 2))

    Pada SQL Server, gunakan titik sebagai pemisah desimal. Ubah query Anda menjadi sebagai berikut

    exec sp_executesql N'SELECT [ItemID],'''' AS [SRGuarantorRuleType],CAST(''0.00'' AS NUMERIC(18, 2)) AS [AmountValue],CAST(''0'' AS BIT) AS [IsValueInPercent],CAST(''1'' AS BIT) AS [IsInclude],CAST(''0'' AS BIT) AS [IsGuarantor],CAST(''0'' AS NUMERIC(18, 2)) AS [BasicPrice],CAST(''0'' AS NUMERIC(18, 2)) AS [CoveragePrice]  FROM [Item] WHERE [ItemID] IN (''XX01'',''Ket10'',''Han03'',''Han03'',''Han03'') AND [IsActive] = @IsActive2 ORDER BY [ItemID] ASC',N'@IsActive2 bit',@IsActive2=1


    Ahmad Masykur http://www.masykur.web.id/

    Senin, 05 November 2012 04.37