0

I have set up an ADO connection to a PostgreSQL database. I was wondering if it were possible from VBA to create functions - e.g I have a DatabaseSetUp function, creating tables and whatnot. I was hoping that I could then add in some functions from VBA.

Possible? If so, could I trouble someone for an example

Thanks

3
  • It's hard to understand exactly what you mean here. Are you trying to create stored procedures/in-database functions written in VBA? Use VBA to create PL/PgSQL stored procs/functions? What? Commented May 15, 2013 at 0:11
  • Sorry was a late night question. I want to create pgSQL funtions from vba and store them in a newly deployed database. A setup/install sub in vba that creates the db, creates tables, then creates funtions that I want to have in the db Commented May 15, 2013 at 5:26
  • statement for function creating is usual SQL statement like other SQL statements. Just send to database SQL command like "CREATE OR REPLACE FUNCTION ...". There are no some special access necessary. Commented May 15, 2013 at 8:12

1 Answer 1

1

It's the same as any other SQL like ordinary SELECTs. Just send the SQL.

You might want to query pg_proc, pg_class, etc (or the information_schema) to determine what already exists, though most statements have IF EXISTS or CREATE OR REPLACE variants.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.