Hi Folks,

I am using v14.6 and setting up SQL access between two databases. Would like to use variables that are complete SQL statements, i.e., SELECT Col From Table WHERE condition INTO :var. The only place we can use INTO is Begin SQL/End SQL. The SQL Login command passes the * so I can use an external DB.

Now the question, is it still true that "execute immediate" should only be used with the internal SQL db when using an entire SQL statement like above in a text variable. I have been using it interpreted s as below and it works great, but I would prefer to follow recommended course. So 4D folks, should I or shouldn't I?

sqlVar:="SELECT Col From Table WHERE condition INTO :var"

SQL Login(external ip; user name, password;*)

Begin SQL

    execute immediate :sqlVar

End SQL

SQL LOGOUT

It would be so much more efficient to generate SQL statements programatically and pass that in to execute in the remote 4D db. Some of the tables I am working with have in excess of 150 columns and the number of variables are too many for a series of parameters in a SQL EXECUTE call. I want to also generate INSERT and UPDATE statements by the vars that are modified. So if anyone has a suggestion on this front as well, it would be appreciated.

Thanks!

Bill


**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to