3

I have an instance of SQL Server that I am trying to benchmark. From the SQL Studio application I can type

SET STATISTICS TIME ON

and see outputted statistics after that. From C++ code, I can do something like

SQLExecDirect(hstmt, "SET STATISTICS TIME ON", SQL_NTS);

and then retrieve these statistics via SQLError.

Is there a way to get at these statistics when accessing SQL Server over vanilla ODBC. In this case I am using Ruby's DBI:ODBC connector which works fine to connect and run queries but I haven't been able to figure out this meta stuff.

Steven Canfield
  • 7,312
  • 5
  • 35
  • 28
  • This is a very interesting question +1 – ichiban May 10 '09 at 08:57
  • I'm confused. ODBC is simply a function mapping shim between the underlying driver and the driver manager. What works directly is identical to "vanilla ODBC". Is the question related to the use of a third party ODBC driver such as FreeTDS to access SQLServer from a different platform or is it actually specific to Rubys DBI interface? – Einstein May 14 '09 at 16:36

2 Answers2

1

Well, it's not going via odbc, but if you have the Sql Server tools, would the Sql Profiler work for you? You can use that to time the execution of statements, transactions, sprocs, and a myriad other things in Sql Server.

eidylon
  • 7,068
  • 20
  • 75
  • 118
0

You could try using dbh.func(:stat)

jim0thy
  • 2,095
  • 1
  • 18
  • 27