Solved

SQL Create Table Decimal

Posted on 2014-10-20
3
181 Views
Last Modified: 2014-10-21
Hi

When I create a table using the following SQL statement the column [Total Stock]  seems to have
no decimal places. Do I have to specify the number of places eg Decimal(18,10)?

 CREATE TABLE MARA ([ID] bigint identity(1,1) not null primary key, [ValA] nvarchar(MAX), [Article] nvarchar(MAX), [Article description] nvarchar(MAX), [Total Stock] Decimal, [BUn] nvarchar(MAX),[MS] nvarchar(50))"
0
Comment
Question by:murbro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 21

Assisted Solution

by:Dale Burrell
Dale Burrell earned 250 total points
ID: 40393634
Correct, or use a predefined format e.g. money which is 4dp (http://msdn.microsoft.com/en-nz/library/ms187752.aspx).
0
 
LVL 50

Accepted Solution

by:
Vitor Montalvão earned 250 total points
ID: 40393797
Yes, you need to provide the number of places:
[Total Stock] Decimal(18,10)
0
 

Author Closing Comment

by:murbro
ID: 40394225
Thanks very much
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question