Click here to Skip to main content
14,240,756 members
Rate this:
Please Sign up or sign in to vote.
See more:
create table tbl_Employee_payment(
Emp_id int foreign key references tbl_EmployeeMast(Emp_id),
paymentdate date,
Empl_name varchar(300),
designation varchar(100),
salary decimal(5,2),
advance_amnt decimal(5,2),
sale_of_month decimal(5,2),
bonus_amnt decimal(5,2),
payment_mode varchar(100),
payment_detail  varchar(max),
payment_amnt decimal (4,3)
)


What I have tried:

insert into tbl_Employee_payment values(1,'2016-02-09','javeer','sss',1000,355.00,11,111.00,'online','transfered',645)
Posted
Updated 25-Feb-16 11:23am
Rate this:
Please Sign up or sign in to vote.

Solution 1

Hi Friend,
create table tbl_Employee_payment(
Emp_id int foreign key references tbl_EmployeeMast(Emp_id),
paymentdate date,
Empl_name varchar(300),
designation varchar(100),
salary decimal(16,2),
advance_amnt decimal(16,2),  
sale_of_month decimal(16,2),  
bonus_amnt decimal(16,2),     
payment_mode varchar(100),
payment_detail  varchar(max),
payment_amnt decimal (16,3)  
)



Change your decimal range to decimal(16,2) in all columns where you are using decimal datatype . hope this will help. thanks..
   
Comments
Member 12270370 10-Feb-16 6:48am
   
Thanks Sir Its Working thanks u again..............
Rate this:
Please Sign up or sign in to vote.

Solution 4

The example insert statement would have been run with no problem.

Probably, you were trying to insert a value which is more than the defined datatype can handle in some other statement.

A decimal(5,2) can handle maximum 5 digits in total (left + right side of the decimal point) and 2 digits to the right side of the decimal point. Have a quick look at:

decimal and numeric (Transact-SQL)[^]

-dp-
   
v3

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100