Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have table column with specification Decimal(10,3).This is my query
SQL
declare @p2 dbo.InvoiceItemType

insert into @p2 values(N'b68f0118-83de-48cb-8799-beefa5b44a72',N'612',N'',N'P.V.C. Transparent Hose  1/2" X 1/8" W.T.',NULL,N'95.00',N'0.00',N'11.875000',N'12.321',NULL,NULL,N'201403014',NULL,N'1',N'1',N'1',N'1',N'1/2" X 1/8" W.T.',N'4')

exec spUpdateInvoiceById @Id='65F394C1-2EF4-4CAA-9FBC-C02AE27AA7F8',@ProductTable_TVP=@p2,@ExtraCharge_TVP=@p3,@InvoiceDate='2014-03-18 00:00:00',@BuyerOrderNo=N'13',@DispatchedThrough=N'85',@Destination=N'',@DispatchDocumentNo=N'95',@ModifiedBy=1,@IsCSTApplicable=0,@MainCopy=0
After this query is executed properly I used select to get the records but when I see result I got '12.320' instead of '12.321'
Posted
Comments
Kornfeld Eliyahu Peter 23-Mar-14 5:45am    
Try convert your string to decimal explicitly (do not let left it to SQL)...

I just tried that here, using SQL2008R2:
Table:
SQL
USE [Testing]
GO

/****** Object:  Table [dbo].[Table_1]    Script Date: 03/23/2014 09:45:38 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Table_1](
    [dec] [decimal](10, 3) NOT NULL
) ON [PRIMARY]

GO

INSERT query:
SQL
INSERT INTO Table_1 (dec) VALUES (N'12.321')

SELECT query:
SQL
SELECT * FROM Table_1

Results:
dec
12.321


So...what am I doing that is different from you?
 
Share this answer
 
There is problem with stored procedure which takes argument (10,2)
 
Share this answer
 
Comments
CHill60 23-Mar-14 6:21am    
If you want either of the responders to see a message you need to use the "Have a Question or Comment?" link or the Reply link next to their post. Don't use Solutions to make comments

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900