KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to perform parameterized queries
PRODUCT: 4D Developer | VERSION: 11 | PLATFORM: Mac & Win
Published On: October 3, 2007

In order to pass a dynamic value to and from SQL, you need to encapsulate the variable name in either double greater than/less than symbols or precede it with a colon in SQL, for example:

<<listbox1>>
:listbox1


The colon-notation represents a parameter to a Parameterized Query.

The bracket notation is called Direct Association.

Here are two examples:

`Example: Move the results of a SQL query into a 4D List Box object, listbox1.
Begin SQL
   SELECT * FROM Customers INTO <<listbox1>>
End SQL


`Example: Insert a value determined in 4D into a SQL statement:
vName:="Joe"
Begin SQL
   SELECT * FROM Customers WHERE Name = :vName
End SQL