{"id":189,"date":"2009-12-15T08:55:03","date_gmt":"2009-12-15T13:55:03","guid":{"rendered":"http:\/\/www.cfchimp.com\/wordpress\/?p=189"},"modified":"2009-12-15T08:55:03","modified_gmt":"2009-12-15T13:55:03","slug":"cf-quickie-cfqueryparam-with-sqls-like-operator","status":"publish","type":"post","link":"https:\/\/csimmons.dev\/blog\/2009\/12\/cf-quickie-cfqueryparam-with-sqls-like-operator\/","title":{"rendered":"CF quickie: cfqueryparam with SQL&#8217;s LIKE operator"},"content":{"rendered":"<p>If you are using cfqueryparam to build a SQL statement from a search form and need to use the SQL&#8217;s LIKE operator here is how it&#8217;s done in the most basic way:<br \/>\n<code><br \/>\n&lt;cfquery name=\"qData\" datasource=\"myDsn\"&gt;<br \/>\nSELECT DISTINCT last_name<br \/>\nFROM person<br \/>\nWHERE last_name LIKE &lt;cfqueryparam cfsqltype=\"cf_sql_varchar\" value=\"#FORM.last_name#%\"&gt;<br \/>\nORDER BY last_name<br \/>\n&lt;\/cfquery&gt;<br \/>\n<\/code><br \/>\nThe magic is all in the % sign at the end of the cfqueryparam value attribute.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are using cfqueryparam to build a SQL statement from a search form and need to use the SQL&#8217;s LIKE operator here is how it&#8217;s done in the most basic way: &lt;cfquery name=&#8221;qData&#8221; datasource=&#8221;myDsn&#8221;&gt; SELECT DISTINCT last_name FROM person WHERE last_name LIKE &lt;cfqueryparam cfsqltype=&#8221;cf_sql_varchar&#8221; value=&#8221;#FORM.last_name#%&#8221;&gt; ORDER BY last_name &lt;\/cfquery&gt; The magic is all in &#8230; <a title=\"CF quickie: cfqueryparam with SQL&#8217;s LIKE operator\" class=\"read-more\" href=\"https:\/\/csimmons.dev\/blog\/2009\/12\/cf-quickie-cfqueryparam-with-sqls-like-operator\/\" aria-label=\"Read more about CF quickie: cfqueryparam with SQL&#8217;s LIKE operator\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_cloudinary_featured_overwrite":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[48,16],"class_list":["post-189","post","type-post","status-publish","format-standard","hentry","tag-coldfusion","tag-sql"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pbVg43-33","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts\/189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/comments?post=189"}],"version-history":[{"count":0,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts\/189\/revisions"}],"wp:attachment":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/media?parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/categories?post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/tags?post=189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}