Here's a strange problem:
I have an arbitrary query that has calculated columns in its output.
It could be a "SELECT TOP 1 * FROM ...", or a "SELECT STDEV(somefield)
FROM ...". It doesn't matter what the exact select is - just that the
data is NOT straight from a table, but is calculated. Anyhow, when I
run the queries in the query analyzer, everything works as expected.
When I make the calls via SQLExecuteDirect, I get back the correct
column counts, names, and data types (I have tried the queries with
named columns via COLx=.. and .. AS COLx). However, when I go to fetch
the data it always says it's a NULL value and doesn't give me
anything.
This only happens on calculated fields, which leads me to believe that
there's maybe a problem with the type of cursor I am using (everything
is using default settings) on SQL Server 2k.
Anyone have any ideas?