How to write to a MSSQL database using the Knex li...
# 🤝help
a
I have a MSSQL database that I need to write to from the variables that I have captured in a workflow. I would prefer to not expose the username and password in the plain text however for testing purposes I don't mind doing it: Below is a code example const knex = require('knex')({ client: 'mssql', connection: { host: '', user: '', password: '', database: '' }, useNullAsDefault: false, log: { warn(message) { console.log(message); }, error(message) { console.error(message); }, deprecate(message) { console.log(message); }, debug(message) { console.log(message); }, } }); const name = 'John'; const surname = 'Doe'; const cellphone = '123456789'; const idNumber = '1234567890'; const client_home = 'Mordor'; const query = ` INSERT INTO client (name, surname, cellphone, id_number) VALUES ('${name}', '${surname}', '${cellphone}', '${idNumber}') `; await knex.raw(query).on('query', function (data) { console.log("Executing: " + data.sql); }).then(function (data) { console.log("Agent data saved successfully!"); }).catch(err => console.log(err));
a
@average-megabyte-82737 We don't include the knex library at the moment. If you could upvote this feature request : https://discord.com/channels/1108396290624213082/1113116484525371422/1113116484525371422 and give an example, that would be helpful. In the meantime, if you want to do this, you'll need to call an api (which you can do with the built-in axios library)
14 Views