SQLArgument[arg1,arg2,…]
holds a sequence of arguments to an SQL query.
Details and Options
Examples
Basic Examples
See Also
Tech Notes
Related Guides
DatabaseLink`
DatabaseLink`
SQLArgument
SQLArgument[arg1,arg2,…]
holds a sequence of arguments to an SQL query.
Details and Options
- To use SQLArgument, you first need to load DatabaseLink using Needs["DatabaseLink`"].
- SQLArgument is always used as an argument to SQLExecute.
Examples
Basic Examples (1)
Needs["DatabaseLink`"]If you find that the examples in this section do not work as shown, you may need to install or restore the example database with the "DatabaseLink`DatabaseExamples`" package, as described in Using the Example Databases.
conn = OpenSQLConnection["demo"];SQLExecute[conn, "SELECT NAME, VALUE FROM SAMPLETABLE1"]Use a prepared statement to execute the same query:
SQLExecute[conn, "SELECT `1` FROM `2`", {SQLArgument[SQLColumn["NAME"], SQLColumn["VALUE"]], SQLTable["SAMPLETABLE1"]}]Use a prepared statement to insert data:
SQLCreateTable[conn, SQLTable["TEST"], {SQLColumn["A", "DataTypeName" -> "Integer"], SQLColumn["B", "DataTypeName" -> "Integer"]}];SQLExecute[conn, "INSERT INTO TEST (A, B) VALUES (`1`)", {SQLArgument[3, 7]}];SQLSelect[conn, "TEST"]SQLDropTable[conn, "TEST"];CloseSQLConnection[conn];