# dbupdate

### (PRO) dbupdate(connector, updateString, dispMessages)

Performs a SQL UPDATE on a database. This can be using the source or target connector.

## Arguments

Argument | Data Type | Description
connector | string | The Connector to use for the query. "S" - use the source connector "T" - target connector "connector name" - use another connector
updateString | string | SQL UPDATE statement to perform.

## Returns

Nothing

## Description

Performs the query passed into the function. You will normally need to build up the SQL UPDATE statement using strings concatenated with field values.

If you use a field name in the SQL, Inaport will parse the SQL and replace the field name with the value of the field. For example, if the field "myField" has the value "abc" and "keyval" = 123, then the SQL will be evaluated as follows:

> UPDATE myTable SET field1 = '#myField' WHERE keyfield = #keyval

> becomes

> UPDATE myTable SET field1 = 'abc' WHERE keyfield = 123

Note that if you are using a function or expression as a string parameter to the SQL, you will need to surround it with single quote characters as shown below:

> UPDATE myTable SET field1 = '" & left(#myField, 5) & "'" WHERE keyfield = #keyval

Note the single quote characters either side of where the function is inserted - they are hard to see.

## Examples

Example | Description
dbupdate("S", "UPDATE myTable SET myField = 'T' WHERE key = '" + #keyVal + "'" ) | Execute an UPDATE statement on the source connector, setting the field "myField" to the value 'T' where the key field has the value contained in the #keyVal field of the import data. Note how the singles quotes are surrounding the value of the #keyVal field - this importatnt to ensure that the SQL is correctly formatted.

### See Also

dbselect(), dblookup(), dbinsert()