Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
SQL Server CE
»
Split integer valuefrom decimal valye
15 posts, Page 1 of 2
1
2
»»
Split integer valuefrom decimal valye
Rate Topic
Display Mode
Topic Options
Author
Message
indraprakash
indraprakash
Posted Monday, July 07, 2008 5:45 AM
SSC Journeyman
Group: General Forum Members
Last Login: Wednesday, September 29, 2010 3:02 AM
Points: 89,
Visits: 53
Hi All,
I want to split integer part from decimal value
e.g. i have a no is 12456324.254 and i want to the output is 12456324
Note: We can't use convert function
Post #529177
ralfik
ralfik
Posted Tuesday, July 08, 2008 5:16 AM
Forum Newbie
Group: General Forum Members
Last Login: Monday, September 17, 2012 8:24 AM
Points: 1,
Visits: 21
Function floor() does not work?
Post #529900
indraprakash
indraprakash
Posted Tuesday, July 08, 2008 5:31 AM
SSC Journeyman
Group: General Forum Members
Last Login: Wednesday, September 29, 2010 3:02 AM
Points: 89,
Visits: 53
Thanks,
It is working
Post #529911
PhilPacha
PhilPacha
Posted Tuesday, July 08, 2008 2:21 PM
Old Hand
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 8:23 AM
Points: 323,
Visits: 2,007
or, use
ROUND(YourValue, 1)
(revised) I'm sorry... I meant ROUND(YourValue, 0, 1)
I apologize for my lack of proof-reading.
The non-zero 2nd parameter truncates the value, without changing the datatype.
Post #530358
Jeff Moden
Jeff Moden
Posted Tuesday, July 08, 2008 2:40 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 7:36 PM
Points: 32,931,
Visits: 26,820
indraprakash (7/7/2008)
Note: We can't use convert function
The ROUND function with the truncate option is definately the way to go... but why is it that you can't use the CONVERT function?
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
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."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #530365
indraprakash
indraprakash
Posted Tuesday, July 08, 2008 10:18 PM
SSC Journeyman
Group: General Forum Members
Last Login: Wednesday, September 29, 2010 3:02 AM
Points: 89,
Visits: 53
Hi,
round function not gives proper output
floor is right.
Post #530475
Jeff Moden
Jeff Moden
Posted Tuesday, July 08, 2008 10:53 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 7:36 PM
Points: 32,931,
Visits: 26,820
indraprakash (7/8/2008)
Hi,
round function not gives proper output
floor is right.
Ummmm.... why do you think that? Using the optional 3rd parameter of ROUND makes it behave like FLOOR but with more control, if you need it.
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
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."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #530482
PhilPacha
PhilPacha
Posted Wednesday, July 09, 2008 7:54 AM
Old Hand
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 8:23 AM
Points: 323,
Visits: 2,007
I'm sorry... I meant ROUND(YourValue, 0, 1)
I apologize for my lack of proof-reading.
Post #530824
Jeff Moden
Jeff Moden
Posted Wednesday, July 09, 2008 8:09 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 7:36 PM
Points: 32,931,
Visits: 26,820
No problem and thanks for the feedback, Phil... I've made similar mistakes... just wanted to be sure...:)
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
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."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #530843
vchandm23
vchandm23
Posted Monday, August 08, 2011 7:54 PM
Forum Newbie
Group: General Forum Members
Last Login: Monday, March 18, 2013 2:47 AM
Points: 5,
Visits: 39
What if i want the other value not the floor value ...........
i mean if its 1234.4321
i want 4321 (values after the decimal place...)?
Cheers,
Chandra
Post #1156494
« Prev Topic
|
Next Topic »
15 posts, Page 1 of 2
1
2
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.