• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Dynamic SQL

Queries of this type are known as dynamic queries because the SQL sent to the database is not known until runtime. Dynamic queries contain both static (common SQL) and dynamic SQL. Let’s look at our GetStates query, written as dynamic SQL in Listing 24.2.

Listing 24.2. GetStates Query Written as Dynamic SQL

<cfquery name="GetStates" datasource="MyTest"> 
     SELECT StateAbbreviation,StateName 
     FROM State 
     WHERE StateName LIKE '#Form.State#%' 
</cfquery> 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint