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 2005 Forums
 Transact-SQL (2005)
 please help me. see the output it differs

Author  Topic 

Ambikaa
Starting Member

43 Posts

Posted - 2008-08-22 : 11:33:12
Hi ,

i need a help. when i used this below query, i am getting wrong result
See the output, it differs from the condition.
SELECT prty_Price FROM tbl_Property WHERE cast(replace(replace(replace(prty_Price,'$',''),',',''),'.','') as int)>= '200000' AND (cast(replace(replace(replace(prty_Price,'$',''),',',''),'.','') as int)<= '400000') AND prty_Deleted=0

output
prty_Price

3456.78
34,3467
200000
234544
345345
345345
3454.45

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-08-22 : 11:37:55
Give an example of an input and an output and tell us what you expected the output to be. Also, you are casting the field to an int and then comparing it to a string.

Jim
Go to Top of Page

RSQLSERVER
Starting Member

5 Posts

Posted - 2008-08-22 : 11:44:44
From the code written, is this what you are planning to do?

There is a prty_Price Column which has something like $32,455.60 and you want to render it as 3245560 . Is that right?
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2008-08-22 : 12:57:11
The results are correct per your condition. Can you explain what you are trying to do, it's probably just a logic error.
Go to Top of Page
   

- Advertisement -