The SQL Server Exec component allows you to execute SQL statements against SQL Server to update/delete data.
It is compatible with SQL Server 2005 and above.
Output Payload
Output Payload | Description |
---|---|
cv.Payload |
In addition to the input payload, it passes LastInsertId or RowsAffected by the executed SQL statement |
LastInsertId is returned when the executed SQL statement was an INSERT statement and the ID generated by the DB could be obtained.
RowsAffected returns the number of records affected by the executed SQL statement. For example, it returns the number of rows deleted when the statement was a DELETE statement.
Component Properties
Property Name | Description |
---|---|
SQL | Specifies the SQL statement to execute |
Bulk Mode | Choose whether to use bulk mode in executing the SQL statement |
Bulk Size | Specifies the size when using bulk mode |
Host | Specifies the host of SQL Server |
Port | Specifies the port of SQL Server |
Username | Specifies the username of SQL Server |
Password | Specifies the password of SQL Server |
Database | Specifies the database |
Encrypt | Specifies whether to disable encryption (not connect with SSL/TLS), true (connect with SSL/TLS), or false (encrypt login only) |
TrustServerCertificate | Select whether to trust the SQL Server’s server certificate. If on, it trusts the certificate sent by SQL Server. If off, it verifies the SQL Server certificate against the trust store certificate |
Root Certificate | Specifies the root certificate to use. If using AWS’s Aurora or RDS, you will need to use the server certificate issued by AWS. This will be the root certificate of that server certificate |
Placeholders
You must use placeholders in the SQL statement to be executed and use the value of cv.Playload in the SQL statement.
UPDATE table1 SET name='Updated name' WHERE id=?
The value of cv.Payload is used for the placeholder specified by ?. When cv.Payload contains 1, it updates the record where id is 1.
You can specify more than one placeholder.
UPDATE table1 SET name=? WHERE id=?
To specify values for more than one placeholder, specify the values in an array in cv.Payload.
["First Last", 20]
Text2SQL
Text2SQL is a function that can generate SQL statements from Japanese entered into the prompt using the functionality of OpenAI’s ChatGPT.
For how to use it, please refer to here.
Need more help with this?
Join our slack community for help