Link to home
Start Free TrialLog in
Avatar of humer2000
humer2000

asked on

Using LIKE in SQL to compare Money type field to a string

hi

i have the following sql statement
" select bla bla bla...... where  Price  " like '%" & Request.form("selectvalue") & "%'"  

This sql statement works Ok in ACCESS but in SQL 2000 i get the following error

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Implicit conversion from data type money to varchar is not allowed. Use the CONVERT function to run this query.

Any idea how to fix that ?
Thx
Avatar of Hilaire
Hilaire
Flag of France image

try

" select bla bla bla...... where  CONVERT(VARCHAR(20), Price)  " like '%" & Request.form("selectvalue") & "%'"  
ASKER CERTIFIED SOLUTION
Avatar of Hilaire
Hilaire
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the slight differences between the two syntaxes

- <BOL>CAST is based on the SQL-92 standard and is preferred over CONVERT.</BOL>
- Casting money datatype to varchar uses varchar(30) as default target datatype