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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 how can i get the dot (.)

Author  Topic 

mrtanvirali
Starting Member

41 Posts

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

regards

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-12 : 02:07:58
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

41 Posts

Posted - 2008-05-12 : 02:18:37
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

30421 Posts

Posted - 2008-05-12 : 02:21:45
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

41 Posts

Posted - 2008-05-12 : 02:24:29
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

30421 Posts

Posted - 2008-05-12 : 03:07:20
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

30421 Posts

Posted - 2008-05-12 : 03:08:13
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

41 Posts

Posted - 2008-05-12 : 03:12:58
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

22864 Posts

Posted - 2008-05-12 : 03:14:59
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
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2008-05-12 : 03:23:26
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

41 Posts

Posted - 2008-05-12 : 03:26:57
thanks all of you,
Go to Top of Page
   

- Advertisement -