SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


format of decimal


format of decimal

Author
Message
sqlfriends
sqlfriends
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3858 Visits: 4017
I have a SSIS package, of attendance data. most of them is a whole number like absent days 5 days, or 100 days in a semester. But some of the elementarys we count by half days, so they may have total absent days like 10.5 days.

Because in the databsae the data type is a decimal(4,1), when I export to a flat file, I would like the whole number still shows whole number, like 20 days, I would like it shows 20 instead of 20.0. but still want those with half days like 10.5 shows like that format.

How can I do a conversion?

Thanks
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)

Group: General Forum Members
Points: 86289 Visits: 41096
sqlfriends (9/4/2013)
I have a SSIS package, of attendance data. most of them is a whole number like absent days 5 days, or 100 days in a semester. But some of the elementarys we count by half days, so they may have total absent days like 10.5 days.

Because in the databsae the data type is a decimal(4,1), when I export to a flat file, I would like the whole number still shows whole number, like 20 days, I would like it shows 20 instead of 20.0. but still want those with half days like 10.5 shows like that format.

How can I do a conversion?

Thanks


I guess I have to ask.... why do you want to build in an inconsistancy here?

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
sqlfriends
sqlfriends
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3858 Visits: 4017
You are right, although I have some reason but I think maybe I should keep it consistent.

A derived question, U use dt_numeric precision 38, scale 1, when I export I expect 0.5. but why it shows
.5 the leading 0 is trimmed off.

Any idea?

Thanks
Phil Parkin
Phil Parkin
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18533 Visits: 20441
sqlfriends (9/4/2013)
You are right, although I have some reason but I think maybe I should keep it consistent.

A derived question, U use dt_numeric precision 38, scale 1, when I export I expect 0.5. but why it shows
.5 the leading 0 is trimmed off.

Any idea?

Thanks


0.5, 00.5, .5 and .50000 are all the same, numerically - the leading and trailing zeros are insignificant. Why does it matter?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search