I'm doing some T-SQL queries and am encountering some strange issues. I did
most of my development in VFP9, where I did something along the lines of:
SQLEXEC(hSQL, 'DELETE FROM table1 WHERE Value = 'Bad'' + CHR(13) + CHR(10) +
'SELECT @@RowCount AS SQLTally', 'SQLTally')
m.nRowsAffected = SQLTally.SQLTally
When I went to test this in our production VFP6 environment, the SQL
statement refuses to generate the SQLTally cursor. It appears to execute
fine, just doesn't return any results. If I execute the two lines as two
seperate SQLEXEC() statements, I can get the result cursor. My question is,
does anyone know why this works in VFP9 and not in VFP6, and how to make it
work in VFP6?
Also, when executing the query in Query Analyzer I get a nice (X row(x)
affected) summary in the Messages tab. Is there anyway to capture and parse
this Messages info in VFP after a SQLEXEC, rather than executing a @@ROWCOUNT
query? I think I've seen code in the past that captures this type of info
(can also be generated SQL side with PRINT) but I can't find any examples
anywhere. This would seem to be the more accurate and efficient way to get
the information I want.