Fire this off in QA and have a read of the error message:
CREATE TABLE #temp (col1 TEXT)
INSERT INTO #temp (col1) VALUES ('Hella Cool')
SELECT * FROM #temp WHERE col1 = 'Hella Cool'
--SELECT * FROM #temp WHERE col1 LIKE 'Hella Cool'
DROP TABLE #temp
Then switch the commented out line to the first SELECT statement.(You'll
have to drop the table for the second run)
Ade
-----Original Message-----
From: Cedric Villat [mailto:[EMAIL PROTECTED]
Sent: 17 February 2005 04:37
To: CF-Talk
Subject: SQL - LIKE vs. =
Ok, so I'm seeing something interesting. I have a field in my MSSQL which is
of type TEXT. I have a query that looks like:
<cfquery name="ThreadChk">
SELECT ThreadID
FROM Threads
WHERE Header LIKE <cfqueryparam cfsqltype="CF_SQL_LONGVARCHAR"
value="#emails.header#">
</cfquery>
This query will return 0 results. Now if I change the field in the DB to be
of type VARCHAR and do something like:
<cfquery name="ThreadChk">
SELECT ThreadID
FROM Threads
WHERE Header = <cfqueryparam cfsqltype="CF_SQL_LONGVARCHAR"
value="#emails.header#">
</cfquery>
This returns 1 record. The #emails.header# contains some carriage returns.
That is the only thing I can think of that is causing the second query to
work and the first query to fail.
Anyone know for sure if this is the reason, or is there something I'm
missing? In the first query I tried placing the %'s around the var, but that
didn't change anything. How can I compare these values if I want to keep the
field as a TEXT type?
Thanks,
Cedric
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.8 - Release Date: 14/02/2005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195143
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54