All Forums Database
sdc 13 posts Joined 06/15
15 Aug 2016
SQL command for setting connection option to return generated keys

I am setting the following parameter in a connection string:


Instead, I'd like to set this option via an SQL command after having made the connection.  What is the command to do so?
The reason I'd like to know is that I'd like to change my Python application (employing PyTd) to accept user-made connection objects and then set them up properly for the application, which requires ReturnGeneratedKeys="C".  This will relieve the user of the need to set up their connection according to the internal needs of my application.  Instead, they establish the connection, give it to my application, and the application will set the option as needed.
I've done extensive searching and found the following tidbits which may be relevevant, but which aren't leading me to the solution I want.

  1. Using the SQL_ATTR_AGKR connection attribute in a call to SQLSetConnectAttr
  2. Using the SQL_ATTR_AGKR statement attribute in a call to SQLSetStmtAttr


sdc 13 posts Joined 06/15
18 Aug 2016

Any insight, anyone? (Bump)

Fred 1096 posts Joined 08/04
19 Aug 2016

There is no SQL statement to change this option. And PyTd doesn't allow you to access a Statement object directly.
Have you considered using an external configuration file?

You must sign in to leave a comment.