INSERT INTO AZURE ODBC


Rob

Recommended Posts

I am trying to Insert a line of data into an AZURE ODBC connection, at a specific time interval in lieu of using the Logging method because for some reason AZURE does not like the SQL that DAQFactory is using in the default.

Link to comment
Share on other sites

Yes, unfortunately there are lots of different dialects of SQL.  DAQFactory defaults to MySQL's dialect, but you can tweak it by clicking the SQL button in the logging set next to the data source name.

Alternatively you can use script and write your own SQL statements.  There are basically three functions you need:

global dbase = db.open("datasourceName")

I would do that in a startup sequence.  Although supported there is usually no reason to close the connection to the datasource.

Once you have a data source handle (in this case "dbase"), you will mostly just use these two functions:

db.execute(dbase, "<some sql statement>")

This will execute the SQL statement.  The statement should be one that does not return any data, i.e. most anything except SELECT.  This would be used to post data to the database use the INSERT INTO statement.  To query data, use something like:

private newData = db.queryToClass(dbase, "select * from mytable")

This should only really be used for SELECT.  For optimization reasons, this function doesn't work well with complex or agregate SQL statements.  In those cases use db.query() along with the recordset functions.  Everything is in 9.5 of the User's Guide.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.