SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 how can i get the dot (.)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mrtanvirali
Starting Member

Pakistan
41 Posts

Posted - 05/12/2008 :  02:04:45  Show Profile  Reply with Quote
dears,
how can i get the dot (.) from the value e.g. 1.235, 0.236 etc.
using sql query

regards

Edited by - mrtanvirali on 05/12/2008 02:05:22

SwePeso
Patron Saint of Lost Yaks

Sweden
30113 Posts

Posted - 05/12/2008 :  02:07:58  Show Profile  Visit SwePeso's Homepage  Reply with Quote
quote:
Originally posted by mrtanvirali

dears,
how can i get the dot (.) from the value e.g. 1.235, 0.236 etc.
using sql query

regards

SELECT '.'


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

mrtanvirali
Starting Member

Pakistan
41 Posts

Posted - 05/12/2008 :  02:18:37  Show Profile  Reply with Quote
dear,

I just want to get those records who's value are in decimal points, e.g. 3.12, 6.71 etc.

NO------------Item--------------------Qty

0460700004-- 12-05-120-013-- No-- 3.12--
0460700004-- 12-01-040-003-- No-- 12----
0460700004-- 12-01-040-005-- No-- 6.71--
0460700004-- 12-01-380-004-- No-- 6.00--
0460700005-- 12-01-140-015-- No-- 1.34--
0460700006-- 12-01-550-014-- No-- 50----
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30113 Posts

Posted - 05/12/2008 :  02:21:45  Show Profile  Visit SwePeso's Homepage  Reply with Quote
SELECT *
FROM Table1
WHERE CAST(Qty AS VARCHAR(12)) LIKE '%.%'



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

mrtanvirali
Starting Member

Pakistan
41 Posts

Posted - 05/12/2008 :  02:24:29  Show Profile  Reply with Quote
thanks peso for reply, the above is returning me all the records not only the decimal figures
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30113 Posts

Posted - 05/12/2008 :  03:07:20  Show Profile  Visit SwePeso's Homepage  Reply with Quote
What datatype is Qty?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30113 Posts

Posted - 05/12/2008 :  03:08:13  Show Profile  Visit SwePeso's Homepage  Reply with Quote
SELECT *
FROM Table1
WHERE FLOOR(Qty) <> CEILING(Qty)



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

mrtanvirali
Starting Member

Pakistan
41 Posts

Posted - 05/12/2008 :  03:12:58  Show Profile  Reply with Quote
ya, thats working fine, thanx,
can you define FLOOR(Qty) <> CEILING(Qty), just for understanding it
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22744 Posts

Posted - 05/12/2008 :  03:14:59  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
quote:
Originally posted by Peso

SELECT *
FROM Table1
WHERE FLOOR(Qty) <> CEILING(Qty)



E 12°55'05.25"
N 56°04'39.16"



or

SELECT *
FROM Table1
WHERE Qty <> CAST(Qty as INT)


Madhivanan

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

RyanRandall
Flowing Fount of Yak Knowledge

United Kingdom
1074 Posts

Posted - 05/12/2008 :  03:23:26  Show Profile  Reply with Quote
quote:
can you define FLOOR(Qty) <> CEILING(Qty), just for understanding it
http://msdn.microsoft.com/en-us/library/ms178531.aspx
FLOOR (Transact-SQL)
Returns the largest integer less than or equal to the specified numeric expression.

http://msdn.microsoft.com/en-us/library/ms189818.aspx
CEILING (Transact-SQL)
Returns the smallest integer greater than, or equal to, the specified numeric expression.



Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

mrtanvirali
Starting Member

Pakistan
41 Posts

Posted - 05/12/2008 :  03:26:57  Show Profile  Reply with Quote
thanks all of you,
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000