Solved

# SQL Create Table Decimal

Posted on 2014-10-20
174 Views
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
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

LVL 21

Assisted Solution

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

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

ID: 40394225
Thanks very much
0

## Featured Post

Question has a verified solution.

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

### Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
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.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
###### Suggested Courses
Course of the Month7 days, 16 hours left to enroll