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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
- <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
" select bla bla bla...... where CONVERT(VARCHAR(20), Price) " like '%" & Request.form("selectvalue"