1

In building a recordset for inserting records into our SQL Server database, there is a precedent to do a SELECT in that the WHERE clause would return no rows. This blank recordset will then be filled before committed back to the database. The point of this is to get the column definitions for the client.

Example:

SELECT * From TableA where key_column = 0

While doing a trace on the database, I have noticed that this methods executes two statements:

One that gets the column metadata...

SET FMTONLY ON SELECT * From TableA where key_column = 0 SET FMTONLY OFF

... and then original select we intended.

Considering that we only want the metadata, is there a way to only run the first statement when constructing the Recordset from within VB6?

(I am aware that using an INSERT statement instead of a recordset would be the most efficient.)

Eric Swanson
  • 664
  • 1
  • 5
  • 11
  • Q: Have you tried explicity using the "SET ON FMTONLY ON SELECT" yourself? Q: Can you query INFORMATION_SCHEMA (or the equivalent admin view for your RDBMS)? – paulsm4 Jan 02 '13 at 21:23
  • Can you confirm what flavour of SQL are you using? Oracle, IBM, SQL Server etc. – twoleggedhorse Jan 02 '13 at 21:32
  • If you are using SQL server, I suggest you take a look at this previous question: http://stackoverflow.com/questions/6215459/t-sql-query-to-show-table-definition – twoleggedhorse Jan 02 '13 at 21:35
  • 1
    Yes, "SQL database" is meaningless noise. Nearly any RDBMS accepts SQL queries. Say "SQL Server" if that's what you mean. – Bob77 Jan 03 '13 at 10:43

0 Answers0