Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone use ODBC Scalar Functions??

Status
Not open for further replies.

bigfella

IS-IT--Management
Apr 13, 2000
13
0
0
GB
I'm having trouble understanding scalar functions. Can anyone tell me why this doesn't work....

SELECT * FROM LiveClient
WHERE {fn UCASE(customer) } LIKE '%#UCase(form.clientname)#%'

It produces a 'Data type mismatch in criteria expression' error.

The field (customer) and form var (clientname) are both strings!!??

 
What happens if you try it without the '' around the variable?

bankholdup
 
I've tried a few variations, but it's the scalar function it doesn't like.

If i do away with the scalar and the CF UCase() function and enter the form.clientname in the correct case, then it works!!
 
The following worked for me:
<HTML>
<HEAD>
<TITLE>Retrieving Employee Data Based on Criteia from Form</TITLE>
</HEAD>
<cfset username = 'B'>
<BODY>
<CFQUERY NAME=&quot;GetEmployees&quot; DATASOURCE=&quot;ActionItems&quot;>
SELECT userID, userName, fullName, email, password
FROM users
WHERE ucase(fullName) like '%#ucase(username)#%'
</CFQUERY>
<H4>Employee Data Based on Criteria from Form</H4>
Last Name: <INPUT TYPE=&quot;Text&quot; NAME=&quot;fullName&quot; SIZE=&quot;20&quot;
MAXLENGTH=&quot;35&quot;><br>


<CFOUTPUT QUERY=&quot;GetEmployees&quot;>
The query returned #GetEmployees.RecordCount# records.
</CFOUTPUT>

<TABLE border=1>
<TR>
<TH>User ID</TH>
<TH>User Name</TH>
<TH>Full Name</TH>
<TH>Email</TH>
<TH>Password</TH>
</TR>
<CFOUTPUT QUERY=&quot;GetEmployees&quot;>
<TR>
<TD>#userID#</TD>
<TD>#userName#</TD>
<TD>#fullName#</TD>
<TD>#email#</TD>
<TD>#password#</TD>
</TR>

</CFOUTPUT>
</TABLE>

</BODY>
</HTML>

Bill Kersey
 
Thanks Bill, that works.

Who needs scalar functions, eh!!!!??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top