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)
 Syntax error converting the varchar value '$12000'

Author  Topic 

Ambikaa
Starting Member

43 Posts

Posted - 2008-08-06 : 08:42:40

Hi,

thanks.
I am getting this while using this query

Syntax error converting the varchar value '$12000' to a column of data type int.

SELECT prty_id, prty_genid,StateId,City,prty_Type,prty_SqrFootage,
Prty_NoOfBedRooms,prty_NoOfBathRooms,prty_Price,prty_status FavStatus
FROM tbl_Property WHERE (cast(prty_Price as int) >= 10000
AND cast(prty_Price as int) <= 60000) AND prty_Deleted=0

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-06 : 08:45:30
Why did you store formatted values in the table?

Instead of cast(prty_Price as int), use cast(replace(prty_Price,'$','') as int)

Madhivanan

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

- Advertisement -