473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to insert Price in SQLServer usimg decimal datatype

Can somebody tell me how to insert price using decimal datatype. I do it in the following way but error comes...ERROR--Table Created Successfully but records are not inserted.....

create table products(vend_id int,prod_id varchar(7),prod_price numeric(2,2))
insert into products values(1001,'TNT1',04.78)
insert into products values(1001,'TNT1',14.78)
insert into products values(1002,'TNT2',15)
insert into products values(1002,'TNT2',5)

select * from products

select vend_id from products where prod_price <= 5

I want to select those vend_id where prod_price <=5
Feb 12 '08 #1
3 14156
scripto
143 100+
prod_price should be AT LEAST decimal(4,2)
Feb 12 '08 #2
Thx Its working.
Why so decimal is atleast (4,2)? Any reason.
Feb 12 '08 #3
@sonia.sardana
Because 4 is the max total amount of numbers. And 2 are the amount of decimal numbers.

12.34 has 4 numbers and two decimal places.
Feb 14 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
0
by: cwbp17 | last post by:
Have a datagrid that displays the price column in this format $12,400.00 from a table. Went to the Property Builder of the datagrid and selected the Price column and changed the Data formatting...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
3
by: ven | last post by:
Hello i have two tables in my MS SQL named table1 and table2. In each table i have a column PRICE with my own datatype decimal 14;4 allows nulls.... now i wanna select from one table to second...
2
by: ven | last post by:
Hello i have two tables in my MS SQL named table1 and table2. In each table i have a column PRICE with my own datatype decimal 14;4 allows nulls.... now i wanna select from one table to second...
0
by: cwbp17 | last post by:
Have a datagrid that displays the price column in this format $12,400.00 from a table. Went to the Property Builder of the datagrid and selected the Price column and changed the Data formatting...
2
by: Fabrizio | last post by:
Hi, i'm trying to use VB .NET i have a datagrid connected to a database: Code | Description | Price | Qty | Total how can i calculate Total as Price*Qty? .... or how can i insert a text...
1
by: Andy Jenkins | last post by:
I'm thinking this ought to be easy (just not for me - lol). Field Price has values like this: 12500 9999 12999 105099 What's happened is that the person who originally populated it...
2
by: ganesh22 | last post by:
How to insert and get actuall value in sqlserver Iam inserting a value of 3.10 using datatype as float but it is inserting as 3.1 how it posible is there any datatype to insert actuall value?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.