.TH STILTS-SQLUPDATE 1 "Mar 2017" "" "Stilts commands" .SH NAME stilts-sqlupdate \- Updates values in an SQL table .SH SYNOPSIS .ad l .HP 17 .hy 0 \fBstilts sqlupdate\fR [db=\fI\fR] [user=\fI\fR] [password=\fI\fR] [select=\fI\fR] [assign=\fI=\fR] [progress=\fItrue|false\fR] .hy .ad .SH DESCRIPTION .PP \fIsqlupdate\fR updates values in an existing table in an SQL database. The rows to update are specified, as a normal SELECT statement, using the \fIselect\fR parameter. Each column to update, and the value to write to it, are given using the \fIassign\fR parameter. .PP Why not just use the database's own UPDATE statement? In most cases, that would be a much better idea. However, using \fIsqlupdate\fR you can write values using STILTS's expression language, and hence take advantage of its various functions, without having to embed them into the database. SQL column names can be used as variables in these expressions, in the same way that table column names are used as variables in other commands such as \fItpipe\fR. .PP This command can only be used if you have access to an SQL database via JDBC. The details of how to configure a JDBC connection to a database are discussed in SUN/256 - obviously you will need a database to connect to and appropriate write permissions on it as well as the relevant drivers. .PP This is a somewhat specialised command, and several (database/driver-specific) things can go wrong with it. If you do not have a fairly good understanding of the database with which you are using it then you may run into problems (but then you'd be unlikely to have the permissions to do the updates in any case). .SH OPTIONS .TP \fBdb=\fI\fR .RS URL which defines a connection to a database. This has the form \fIjdbc::\fR - the details are database- and driver-dependent. Consult Sun's JDBC documentation and that for the particular JDBC driver you are using for details. Note that the relevant driver class will need to be on your classpath and referenced in the \fIjdbc.drivers\fR system property as well for the connection to be made. .RE .TP \fBuser=\fI\fR .RS User name for logging in to SQL database. Defaults to the current username. .RE .TP \fBpassword=\fI\fR .RS Password for logging in to SQL database. .RE .TP \fBselect=\fI\fR .RS Gives the full text (including "\fISELECT\fR") of the SELECT statement to identify which rows undergo updates. .RE .TP \fBassign=\fI=\fR .RS Assigns new values for a given column. The assignment is made in the form \fI=\fR where \fI\fR is the name of a column in the SQL table and \fI\fR is the text of an expression using STILTS's expression language, as described in SUN/256. SQL table column names or $ID identifiers may be used as variables in the usual way. .PP This parameter may be supplied more than once to effect multiple assignments, or multiple assignments may be made by separating them with semicolons in the value of this parameter. .RE .TP \fBprogress=\fItrue|false\fR .RS If true, a spinner will be drawn on standard error which shows how many rows have been updated so far. .RE .SH SEE ALSO \fBstilts\fR(1) .PP If the package stilts-doc is installed, the full documentation \fBSUN/256\fR is available in HTML format: .br \%file:///usr/share/doc/stilts/sun256/index.html .SH VERSION STILTS version 3.4.10-debian .PP This is the Debian version of Stilts, which lack the support of some file formats and network protocols. For differences see .br \%file:///usr/share/doc/stilts/README.Debian .SH AUTHOR Mark Taylor (Bristol University)