Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 data type

Author  Topic 

newbie007
Starting Member

37 Posts

Posted - 2009-04-09 : 05:40:41
I have a table where one of the columns has data with 5 decimal points eg, 17.23452. I entered it as a numeric /decimal data type but it is being displayed without the decimal points - only the whole numbers are shown. How can I get the decimal points ?

Mangal Pardeshi
Posting Yak Master

110 Posts

Posted - 2009-04-09 : 05:50:32
What scale and precision you have defined?

see the example
DECLARE @A decimal, @b decimal(5,3)
select @a=18.256, @b=18.256
select @a, @b

does it explain what you may have missed?

Mangal Pardeshi
http://mangalpardeshi.blogspot.com
Go to Top of Page

newbie007
Starting Member

37 Posts

Posted - 2009-04-09 : 06:05:33
quote:
Originally posted by Mangal Pardeshi

What scale and precision you have defined?

see the example
DECLARE @A decimal, @b decimal(5,3)
select @a=18.256, @b=18.256
select @a, @b

does it explain what you may have missed?

Mangal Pardeshi
http://mangalpardeshi.blogspot.com



sorry - i dint get you.
im importing the date from a file. the particular column has 5numbers following the decimal point.in enterprise manager ive given data type as numeric but the table only displays the whole number (without figs after the decimal point) how do i rectify this ?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-04-09 : 06:09:24
quote:
Originally posted by newbie007

quote:
Originally posted by Mangal Pardeshi

What scale and precision you have defined?

see the example
DECLARE @A decimal, @b decimal(5,3)
select @a=18.256, @b=18.256
select @a, @b

does it explain what you may have missed?

Mangal Pardeshi
http://mangalpardeshi.blogspot.com



sorry - i dint get you.
im importing the date from a file. the particular column has 5numbers following the decimal point.in enterprise manager ive given data type as numeric but the table only displays the whole number (without figs after the decimal point) how do i rectify this ?


it should be decimal(10,5)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

newbie007
Starting Member

37 Posts

Posted - 2009-04-09 : 06:29:15
[
[/quote]
it should be decimal(10,5)


Madhivanan

Failing to plan is Planning to fail
[/quote]

where/how do i apply this decimal(10,5) ? whats the syntax ?
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2009-04-09 : 07:17:00
In BOL (books online, the help included with SQL Server), look up ALTER TALBE and ALTER COLUMN.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL or How to sell Used Cars
For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

newbie007
Starting Member

37 Posts

Posted - 2009-04-09 : 13:47:14
quote:
Originally posted by DonAtWork

In BOL (books online, the help included with SQL Server), look up ALTER TALBE and ALTER COLUMN.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL or How to sell Used Cars
For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp



ive tried

ALTER Table T
Alter Column C Decimal (10,5)

(T- my table, C - column)
The values are still being displayed without nay decimal points
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-04-09 : 13:59:48
trying importing the file again after you alter the table.
Go to Top of Page

newbie007
Starting Member

37 Posts

Posted - 2009-04-11 : 04:52:00
quote:
Originally posted by sakets_2000

trying importing the file again after you alter the table.



1)My data needs to be imported from 6 different files.Instead can I create new table with the above decimal specifications and then copy all data from the existing table

2)Is it possible to import data from different files onto a single table using enterprise manager/DTS/import data
Go to Top of Page
   

- Advertisement -