Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


format of decimal


format of decimal

Author
Message
sqlfriends
sqlfriends
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2047 Visits: 3863
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-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45315 Visits: 39936
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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
sqlfriends
sqlfriends
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2047 Visits: 3863
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
SSCrazy Eights
SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)

Group: General Forum Members
Points: 8404 Visits: 19506
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